|
||||||||
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 |
---|
Fields inherited from class processing.core.PImage |
---|
format, height, parent, pixels, width |
Fields inherited from interface processing.core.PConstants |
---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
Fields inherited from interface codeanticode.glgraphics.GLConstants |
---|
COLOR, DOUBLE, FLOAT, 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, TEX_FILTER_PARAM_FLOAT, TEX_FILTER_PARAM_INT, TEX_FILTER_PARAM_MAT2, TEX_FILTER_PARAM_MAT3, TEX_FILTER_PARAM_MAT4, TEX_FILTER_PARAM_VEC2, TEX_FILTER_PARAM_VEC3, TEX_FILTER_PARAM_VEC4, TEX_INT, TEX_UBYTE, TEX1, TEX1D, TEX2D, TEX3, TEX4, TEXRECT |
Constructor Summary | |
---|---|
GLTexture(processing.core.PApplet parent)
Creates an instance of GLTexture with size 1x1. |
|
GLTexture(processing.core.PApplet parent,
int size)
Creates an instance of GLTexture with power-of-two width and height that such that width * height is the closest to size. |
|
GLTexture(processing.core.PApplet parent,
int size,
GLTextureParameters params)
Creates an instance of GLTexture with power-of-two width and height that such that width height is the closest to size, and with the specified parameters. |
|
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,
int width,
int height,
int format)
Creates an instance of GLTexture with size width x height and with the specified format. |
|
GLTexture(processing.core.PApplet parent,
int width,
int height,
int format,
int filter)
Creates an instance of GLTexture with size width x height and with the specified format and filtering. |
|
GLTexture(processing.core.PApplet parent,
java.lang.String filename)
Creates an instance of GLTexture using image file filename as source. |
|
GLTexture(processing.core.PApplet parent,
java.lang.String filename,
GLTextureParameters params)
Creates an instance of GLTexture using image file filename as source and the specified texture parameters. |
|
GLTexture(processing.core.PApplet parent,
java.lang.String filename,
int format)
Creates an instance of GLTexture using image file filename as source and the specified format. |
|
GLTexture(processing.core.PApplet parent,
java.lang.String filename,
int format,
int filter)
Creates an instance of GLTexture using image file filename as source and the specified format and filtering. |
Method Summary | |
---|---|
boolean |
available()
Returns true if the texture has been initialized. |
void |
clear(float gray)
Fills the texture with the specified gray tone. |
void |
clear(float gray,
float alpha)
Fills the texture with the specified gray tone and alpha value. |
void |
clear(float x,
float y,
float z)
Fills the texture with the specified color components. |
void |
clear(float x,
float y,
float z,
float a)
Fills the texture with the specified color components and alpha component. |
void |
clear(int gray)
Fills the texture with the specified gray tone. |
void |
clear(int rgb,
float alpha)
Fills the texture with the specified rgb color and alpha value. |
void |
clear(int gray,
int alpha)
Fills the texture with the specified gray tone and alpha value. |
void |
clear(int x,
int y,
int z)
Fills the texture with the specified color components. |
void |
clear(int x,
int y,
int z,
int a)
Fills the texture with the specified color components and alpha component. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex)
Applies filter texFilter using this texture as source and destTex as destination. |
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,
float[]... values)
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 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[]... values)
Applies filter texFilter using this texture as source and destTex as destination. |
void |
filter(GLTextureFilter texFilter,
GLTexture destTex,
float fadeConst,
float[]... values)
Applies filter texFilter using this texture as source, destTex as destination and fadeConst as the fading constant for the filter. |
void |
getBuffer(float[] floatArray,
int format)
Copies the texture into floatArray. |
void |
getBuffer(int[] intArray)
Copies the texture into intArray, assuming that the array has 4 components and the pixels are unsigned bytes. |
void |
getBuffer(int[] intArray,
int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are unsigned bytes. |
void |
getBuffer(int[] intArray,
int format,
int type)
Copies the texture into intArray, using the specified format and type. |
void |
getByteBuffer(int[] intArray,
int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are unsigned bytes. |
void |
getImage(processing.core.PImage img)
Copies texture to img. |
void |
getIntBuffer(int[] intArray,
int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are integers. |
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. |
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 |
loadTexture(java.lang.String filename,
GLTextureParameters params)
Load texture, pixels and image from file using the specified texture parameters. |
void |
loadTexture(java.lang.String filename,
int format)
Load texture, pixels and image from file using the specified texture format. |
void |
loadTexture(java.lang.String filename,
int format,
int filter)
Load texture, pixels and image from file using the specified texture format and filtering. |
void |
paint(float gray)
Paints the texture with the specified gray tone. |
void |
paint(float gray,
float alpha)
Paints the texture with the specified gray tone and alpha value. |
void |
paint(float x,
float y,
float z)
Paints the texture with the specified color components. |
void |
paint(float x,
float y,
float z,
float a)
Paints the texture with the specified color components and alpha component. |
void |
paint(int gray)
Paints the texture with the specified gray tone. |
void |
paint(int rgb,
float alpha)
Paints the texture with the specified rgb color and alpha value. |
void |
paint(int gray,
int alpha)
Paints the texture with the specified gray tone and alpha value. |
void |
paint(int x,
int y,
int z)
Paints the texture with the specified color components. |
void |
paint(int x,
int y,
int z,
int a)
Paints the texture with the specified color components and alpha component. |
void |
putBuffer(float[] floatArray)
Copies floatArray into the texture, assuming that the array has 4 components. |
void |
putBuffer(float[] floatArray,
int format)
Copies floatArray into the texture, using the specified format. |
void |
putBuffer(int[] intArray)
Copies intArray into the texture, assuming that the array contains 4 color components and pixels are unsigned bytes. |
void |
putBuffer(int[] intArray,
int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are unsigned bytes. |
void |
putBuffer(int[] intArray,
int format,
int type)
Copies intArray into the texture, using the format and type specified. |
void |
putBuffer(java.nio.IntBuffer buffer,
int format,
int type)
Copies buffer into the texture, using the format and type specified. |
void |
putByteBuffer(int[] intArray,
int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are unsigned bytes. |
void |
putImage(processing.core.PImage img)
Puts img into texture, pixels and image. |
void |
putImage(processing.core.PImage img,
GLTextureParameters params)
Puts img into texture, pixels and image. |
void |
putImage(processing.core.PImage img,
int format)
Puts img into texture, pixels and image. |
void |
putImage(processing.core.PImage img,
int format,
int filter)
Puts img into texture, pixels and image. |
void |
putIntBuffer(int[] intArray,
int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are integers. |
void |
putPixelsIntoTexture(processing.core.PImage img)
Puts pixels of img into texture only. |
void |
putPixelsIntoTexture(processing.core.PImage img,
int x,
int y,
int w,
int h)
Puts the pixels of img inside the rectangle (x, y, x+w, y+h) into texture only. |
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. |
void |
setRandom(float r0,
float r1,
float g0,
float g1,
float b0,
float b1,
float a0,
float a1)
Sets the texture to have random values in the ranges specified for each component. |
void |
setRandomDir2D(float r0,
float r1,
float phi0,
float phi1)
Sets the texture to have random values in the first two coordinates chosen on the circular region defined by the parameters. |
void |
setRandomDir3D(float r0,
float r1,
float phi0,
float phi1,
float theta0,
float theta1)
Sets the texture to have random values in the first three coordinates chosen on the spherical region defined by the parameters. |
void |
setValue(float r,
float g,
float b,
float a)
Sets the texture to have the same given float value in each component. |
void |
setZero()
Sets to zero all the pixels of the texture. |
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, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GLTexture(processing.core.PApplet parent)
parent
- PAppletpublic GLTexture(processing.core.PApplet parent, int width, int height)
parent
- PAppletwidth
- intheight
- intpublic GLTexture(processing.core.PApplet parent, int width, int height, GLTextureParameters params)
parent
- PAppletwidth
- intheight
- intparams
- GLTextureParameterspublic GLTexture(processing.core.PApplet parent, int width, int height, int format)
parent
- PAppletwidth
- intheight
- intformat
- intpublic GLTexture(processing.core.PApplet parent, int width, int height, int format, int filter)
parent
- PAppletwidth
- intheight
- intformat
- intfilter
- intpublic GLTexture(processing.core.PApplet parent, java.lang.String filename)
parent
- PAppletfilename
- Stringpublic GLTexture(processing.core.PApplet parent, java.lang.String filename, GLTextureParameters params)
parent
- PAppletfilename
- Stringparams
- GLTextureParameterspublic GLTexture(processing.core.PApplet parent, java.lang.String filename, int format)
parent
- PAppletfilename
- Stringformat
- intpublic GLTexture(processing.core.PApplet parent, java.lang.String filename, int format, int filter)
parent
- PAppletfilename
- Stringformat
- intfilter
- intpublic GLTexture(processing.core.PApplet parent, int size)
parent
- PAppletsize
- intpublic GLTexture(processing.core.PApplet parent, int size, GLTextureParameters params)
parent
- PAppletsize
- intparams
- GLTextureParametersMethod Detail |
---|
public void init(int width, int height)
width
- intheight
- intpublic 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 putImage(processing.core.PImage img, int format)
img
- PImageformat
- intpublic void putImage(processing.core.PImage img, int format, int filter)
img
- PImageformat
- intfilter
- intpublic void putImage(processing.core.PImage img, GLTextureParameters params)
img
- PImageparams
- GLTextureParameterspublic void putPixelsIntoTexture(processing.core.PImage img)
img
- PImagepublic void putPixelsIntoTexture(processing.core.PImage img, int x, int y, int w, int h)
img
- PImagex
- inty
- intw
- inth
- intpublic void getImage(processing.core.PImage img)
img
- PImagepublic void loadTexture(java.lang.String filename)
filename
- Stringpublic void loadTexture(java.lang.String filename, GLTextureParameters params)
filename
- Stringparams
- GLTextureParameterspublic void loadTexture(java.lang.String filename, int format)
filename
- Stringformat
- intpublic void loadTexture(java.lang.String filename, int format, int filter)
filename
- Stringformat
- intfilter
- intpublic void loadTexture()
public void updateTexture()
public void filter(GLTextureFilter texFilter, GLTexture destTex)
texFilter
- GLTextureFilterdestTex
- GLTexturepublic void filter(GLTextureFilter texFilter, GLTexture destTex, float[]... values)
texFilter
- GLTextureFilterdestTex
- GLTexturefloat[]
- valuespublic void filter(GLTextureFilter texFilter, GLTexture destTex, float fadeConst)
texFilter
- GLTextureFilterdestTex
- GLTexturefadeConst
- floatpublic void filter(GLTextureFilter texFilter, GLTexture destTex, float fadeConst, float[]... values)
texFilter
- GLTextureFilterdestTex
- GLTexturefadeConst
- floatfloat[]
- valuespublic void filter(GLTextureFilter texFilter, GLTexture[] destTexArray, float fadeConst)
texFilter
- GLTextureFilterdestTexArray
- GLTexture[]fadeConst
- floatpublic void filter(GLTextureFilter texFilter, GLTexture[] destTexArray, float fadeConst, float[]... values)
texFilter
- GLTextureFilterdestTexArray
- GLTexture[]fadeConst
- floatfloat[]
- valuespublic void render()
public void render(float x, float y)
x
- floaty
- floatpublic void render(float x, float y, float w, float h)
x
- floaty
- floatw
- floath
- floatpublic void putBuffer(int[] intArray)
intArray
- int[]public void putBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void putByteBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void putIntBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void putBuffer(int[] intArray, int format, int type)
intArray
- int[]format
- inttype
- intpublic void putBuffer(java.nio.IntBuffer buffer, int format, int type)
buffer
- IntBufferformat
- inttype
- intpublic void putBuffer(float[] floatArray)
floatArray
- float[]format
- intpublic void putBuffer(float[] floatArray, int format)
floatArray
- float[]format
- intpublic void getBuffer(int[] intArray)
intArray
- int[]format
- intpublic void getBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void getByteBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void getIntBuffer(int[] intArray, int format)
intArray
- int[]format
- intpublic void getBuffer(int[] intArray, int format, int type)
intArray
- int[]format
- inttype
- intpublic void getBuffer(float[] floatArray, int format)
floatArray
- float[]format
- intpublic void setRandom(float r0, float r1, float g0, float g1, float b0, float b1, float a0, float a1)
r0
- floatr1
- floatg0
- floatg1
- floatb0
- floatb1
- floata0
- floata1
- floatpublic void setRandomDir2D(float r0, float r1, float phi0, float phi1)
r0
- floatr1
- floatphi0
- floatphi1
- floatpublic void setRandomDir3D(float r0, float r1, float phi0, float phi1, float theta0, float theta1)
r0
- floatr1
- floatphi0
- floatphi1
- floattheta0
- floattheta1
- floatpublic void setValue(float r, float g, float b, float a)
r
- floatg
- floatb
- floata
- floatpublic void setZero()
public void clear(int gray)
gray
- intpublic void clear(float gray)
gray
- floatpublic void clear(int gray, int alpha)
gray
- intalpha
- intpublic void clear(int rgb, float alpha)
rgb
- intalpha
- floatpublic void clear(float gray, float alpha)
gray
- floatalpha
- floatpublic void clear(int x, int y, int z)
x
- inty
- intz
- intpublic void clear(float x, float y, float z)
x
- floaty
- floatz
- floatpublic void clear(int x, int y, int z, int a)
x
- inty
- intz
- inta
- intpublic void clear(float x, float y, float z, float a)
x
- floaty
- floatz
- floata
- floatpublic void paint(int gray)
gray
- intpublic void paint(float gray)
gray
- floatpublic void paint(int gray, int alpha)
gray
- intalpha
- intpublic void paint(int rgb, float alpha)
rgb
- intalpha
- floatpublic void paint(float gray, float alpha)
gray
- floatalpha
- floatpublic void paint(int x, int y, int z)
x
- inty
- intz
- intpublic void paint(float x, float y, float z)
x
- floaty
- floatz
- floatpublic void paint(int x, int y, int z, int a)
x
- inty
- intz
- inta
- intpublic void paint(float x, float y, float z, float a)
x
- floaty
- floatz
- floata
- float
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |