|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectprocessing.core.PImage
codeanticode.glgraphics.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 boolean |
flippedX
|
protected boolean |
flippedY
|
protected GL |
gl
|
protected GLState |
glstate
|
protected int |
magFilter
|
protected float |
maxTexCoordS
|
protected float |
maxTexCoordT
|
protected int |
minFilter
|
protected PGraphicsOpenGL |
pgl
|
protected int[] |
tex
|
protected int |
texInternalFormat
|
protected int |
texTarget
|
protected boolean |
usingMipmaps
|
| Fields inherited from class processing.core.PImage |
|---|
cache, format, height, imageMode, modified, mx1, mx2, my1, my2, parent, pixels, saveImageFormats, smooth, width |
| Fields inherited from interface processing.core.PConstants |
|---|
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BURN, CENTER, CENTER_RADIUS, CHATTER, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_AUTO_GZIP, DISABLE_DEPTH_TEST, DISABLE_ERROR_REPORT, DISABLE_FLYING_POO, DODGE, DOWN, DXF, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENTER, EPSILON, ERODE, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINES, LINUX, MACOS9, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMALIZED, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PDF, PERSPECTIVE, PI, PIXEL_CENTER, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, WAIT, WHITESPACE, WINDOWS |
| Fields inherited from interface codeanticode.glgraphics.GLConstants |
|---|
COLOR, DOUBLE4, FLOAT4, GL_DEPTH_STENCIL, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, GLGRAPHICS, LINEAR, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, NEAREST, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, NORMAL, RECTANGULAR |
| Constructor Summary | |
|---|---|
GLTexture(processing.core.PApplet parent)
Creates an instance of GLTexture with size 1x1. |
|
GLTexture(processing.core.PApplet parent,
int width,
int height)
Creates an instance of GLTexture with size width x height. |
|
GLTexture(processing.core.PApplet parent,
int width,
int height,
GLTextureParameters params)
Creates an instance of GLTexture with size width x height and with the specified parameters. |
|
GLTexture(processing.core.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,
float fadeConst)
Applies filter texFilter using this texture as source, destTex as multiple destinations and fadeConst as the fading constant for the filter. |
void |
filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
float fadeConst,
GLTextureFilterParameters params)
Applies filter texFilter using this texture as source, destTex as multiple destinations, fadeConst as the fading constant for the filter and params as the parameters for the filter. |
void |
filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
GLTextureFilterParameters 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,
float fadeConst)
Applies filter texFilter using this texture as source, destTex as destination and fadeConst as the fading constant for the filter. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex,
float fadeConst,
GLTextureFilterParameters params)
Applies filter texFilter using this texture as source, destTex as destination, fadeConst as the fading constant for the filter and params as the parameters for the filter. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex,
GLTextureFilterParameters params)
Applies filter texFilter using this texture as source, destTex as destination and params as the parameters for the filter. |
void |
getImage(processing.core.PImage img)
Copies texture to img. |
float |
getMaxTextureCoordS()
Returns the maximum possible value for the texture coordinate S. |
float |
getMaxTextureCoordT()
Returns the maximum possible value for the texture coordinate T. |
int |
getTextureID()
Provides the ID of the opegl texture object. |
int |
getTextureInternalFormat()
Returns the texture internal format. |
int |
getTextureMagFilter()
Returns the texture magnification filter. |
int |
getTextureMinFilter()
Returns the texture minimization filter. |
int |
getTextureTarget()
Returns the texture target. |
void |
init(int width,
int height)
Sets the size of the image and texture to width x height. |
void |
init(int width,
int height,
GLTextureParameters params)
Sets the size of the image and texture to width x height, and the parameters of the texture to params . |
protected void |
initTexture(int w,
int h)
|
boolean |
isFlippedX()
Returns true if the texture is flipped along the horizontal direction. |
boolean |
isFlippedY()
Returns true if the texture is flipped along the vertical direction. |
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(processing.core.PImage img)
Puts img into texture, pixels and image. |
protected void |
putPixels(int[] pix)
|
void |
putPixelsIntoTexture(processing.core.PImage img)
Puts pixels of img into texture only. |
protected void |
releaseTexture()
|
void |
render()
Draws the texture using the opengl commands, inside a rectangle located at the origin with the original size of the texture. |
void |
render(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 |
render(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 |
setFlippedX(boolean v)
Sets the texture as flipped or not flipped on the horizontal direction. |
void |
setFlippedY(boolean v)
Sets the texture as flipped or not flipped on the vertical direction. |
protected void |
setTextureParams(GLTextureParameters params)
|
void |
updateTexture()
Copy texture to pixels (doesn't call updatePixels). |
boolean |
usingMipmaps()
Returns true or false whether or not the texture is using mipmaps. |
| Methods inherited from class processing.core.PImage |
|---|
blend, blend, blendColor, blurAlpha, blurARGB, blurRGB, buildBlurKernel, checkAlpha, clone, copy, copy, dilate, filter, filter, get, get, get, imageMode, init, intersect, loadPixels, loadTIFF, mask, mask, noSmooth, save, saveImageIO, saveTGA, saveTIFF, set, set, setImpl, smooth, updatePixels, updatePixels |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GL gl
protected PGraphicsOpenGL pgl
protected int[] tex
protected int texTarget
protected int texInternalFormat
protected int minFilter
protected int magFilter
protected boolean usingMipmaps
protected float maxTexCoordS
protected float maxTexCoordT
protected boolean flippedX
protected boolean flippedY
protected GLState glstate
| Constructor Detail |
|---|
public GLTexture(processing.core.PApplet parent)
parent - PApplet
public GLTexture(processing.core.PApplet parent,
int width,
int height)
parent - PAppletwidth - intheight - int
public GLTexture(processing.core.PApplet parent,
int width,
int height,
GLTextureParameters params)
parent - PAppletwidth - intheight - intparams - GLTextureParameters
public GLTexture(processing.core.PApplet parent,
java.lang.String filename)
filename - String| Method Detail |
|---|
public void init(int width,
int height)
width - intheight - int
public void init(int width,
int height,
GLTextureParameters params)
width - intheight - intparams - GLTextureParameterspublic boolean available()
public int getTextureID()
public int getTextureTarget()
public int getTextureInternalFormat()
public int getTextureMinFilter()
public int getTextureMagFilter()
public boolean usingMipmaps()
public float getMaxTextureCoordS()
public float getMaxTextureCoordT()
public boolean isFlippedX()
public void setFlippedX(boolean v)
v - boolean;public boolean isFlippedY()
public void setFlippedY(boolean v)
v - boolean;public void putImage(processing.core.PImage img)
img - PImagepublic void putPixelsIntoTexture(processing.core.PImage img)
img - PImagepublic void getImage(processing.core.PImage img)
img - PImagepublic void loadTexture(java.lang.String filename)
filename - Stringpublic void loadTexture()
public void updateTexture()
public void filter(GLTextureFilter texFilter,
GLTexture destTex)
texFilter - GLTextureFilterdestTex - GLTexture
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray)
texFilter - GLTextureFilterdestTexArray - GLTexture[]
public void filter(GLTextureFilter texFilter,
GLTexture destTex,
GLTextureFilterParameters params)
texFilter - GLTextureFilterdestTex - GLTextureparams - GLTextureFilterParameters
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
GLTextureFilterParameters params)
texFilter - GLTextureFilterdestTexArray - GLTexture[]params - GLTextureFilterParameters
public void filter(GLTextureFilter texFilter,
GLTexture destTex,
float fadeConst)
texFilter - GLTextureFilterdestTex - GLTexturefadeConst - float
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
float fadeConst)
texFilter - GLTextureFilterdestTexArray - GLTexture[]fadeConst - float
public void filter(GLTextureFilter texFilter,
GLTexture destTex,
float fadeConst,
GLTextureFilterParameters params)
texFilter - GLTextureFilterdestTex - GLTexturefadeConst - float
public void filter(GLTextureFilter texFilter,
GLTexture[] destTexArray,
float fadeConst,
GLTextureFilterParameters params)
texFilter - GLTextureFilterdestTexArray - GLTexture[]fadeConst - floatpublic void render()
public void render(float x,
float y)
x - floaty - float
public void render(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()
protected void putPixels(int[] pix)
pix - int[]protected void setTextureParams(GLTextureParameters params)
target - intparams - GLTextureParameters
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||