|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPImage
codeanticode.gltexture.GLTexture
public class GLTexture
This class adds an opengl texture to a PImage object. The texture is handled in a similar way to the pixels property: image data can be copied to and from the texture using loadTexture and updateTexture methods. However, bringing the texture down to image or pixels data can slow down the application considerably (since involves copying texture data from GPU to CPU), especially when handling large textures. So it is recommended to do all the texture handling without calling updateTexture, and doing so only at the end if the texture is needed as a regular image.
| Field Summary | |
|---|---|
protected GL |
gl
|
protected GLState |
glstate
|
protected PGraphicsOpenGL |
pgl
|
protected int[] |
tex
|
| Constructor Summary | |
|---|---|
GLTexture(PApplet parent)
Creates an instance of GLTexture with size 1x1. |
|
GLTexture(PApplet parent,
int width,
int height)
Creates an instance of GLTexture with size width x height. |
|
GLTexture(PApplet parent,
java.lang.String filename)
Creates an instance of GLTexture using image file filename as source. |
|
| Method Summary | |
|---|---|
boolean |
available()
Returns true if the texture has been initialized. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex)
Applies filter texFilter using this texture as source and destTex as destination. |
void |
filter(GLTextureFilter texFilter,
GLTexture[] destTexArray)
Applies filter texFilter using this texture as source and destTex as multiple destinations. |
void |
filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
GLTextureFilterParams params)
Applies filter texFilter using this texture as source, destTex as multiple destinations and params as the parameters for the filter. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex,
GLTextureFilterParams params)
Applies filter texFilter using this texture as source, destTex as destination and params as the parameters for the filter. |
void |
getImage(PImage img)
Copies texture to img. |
int |
getTextureID()
Provides the ID of the opegl texture object. |
int |
getTextureTarget()
Returns the texture target. |
void |
init(int width,
int height)
Sets the size of the image and texture to width x height. |
protected void |
initTexture(int w,
int h)
|
void |
loadTexture()
Copy pixels to texture (loadPixels should have been called beforehand). |
void |
loadTexture(java.lang.String filename)
Load texture, pixels and image from file. |
void |
putImage(PImage img)
Puts img into texture, pixels and image. |
void |
putPixels(int[] pix)
|
void |
putPixelsIntoTexture(PImage img)
Puts pixels of img into texture only. |
protected void |
releaseTexture()
|
void |
renderTexture()
Draws the texture using the opengl commands, inside a rectangle located at the origin with the original size of the texture. |
void |
renderTexture(float x,
float y)
Draws the texture using the opengl commands, inside a rectangle located at (x,y) with the original size of the texture. |
void |
renderTexture(float x,
float y,
float w,
float h)
Draws the texture using the opengl commands, inside a rectangle of width w and height h located at (x,y). |
void |
updateTexture()
Copy texture to pixels (doesn't call updatePixels). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GL gl
protected PGraphicsOpenGL pgl
protected int[] tex
protected GLState glstate
| Constructor Detail |
|---|
public GLTexture(PApplet parent)
parent - PApplet
public GLTexture(PApplet parent,
int width,
int height)
parent - PAppletwidth - intheight - int
public GLTexture(PApplet parent,
java.lang.String filename)
filename - String| Method Detail |
|---|
public void init(int width,
int height)
width - intheight - intpublic boolean available()
public int getTextureID()
public int getTextureTarget()
public void putImage(PImage img)
img - PImagepublic void putPixelsIntoTexture(PImage img)
img - PImagepublic void getImage(PImage img)
img - PImagepublic void loadTexture(java.lang.String filename)
filename - Stringpublic void loadTexture()
public void updateTexture()
public void filter(GLTextureFilter texFilter,
GLTexture destTex)
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray)
public void filter(GLTextureFilter texFilter,
GLTexture destTex,
GLTextureFilterParams params)
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
GLTextureFilterParams params)
public void renderTexture()
public void renderTexture(float x,
float y)
x - floaty - float
public void renderTexture(float x,
float y,
float w,
float h)
x - floaty - floatw - floath - float
protected void initTexture(int w,
int h)
w - inth - intprotected void releaseTexture()
public void putPixels(int[] pix)
pix - int[]
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||