codeanticode.glgraphics
Class GLTexture

java.lang.Object
  extended by processing.core.PImage
      extended by codeanticode.glgraphics.GLTexture
All Implemented Interfaces:
GLConstants, java.lang.Cloneable, processing.core.PConstants

public class GLTexture
extends processing.core.PImage
implements processing.core.PConstants, GLConstants

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, BILINEAR, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLAMP, 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_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, DYNAMIC, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, 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, FIXED, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HAS_NORMAL, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINEAR, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, OPENGL2, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINT_SPRITES, POINTS, POLYGON, POSTERIZE, PROBLEM, PROG_GL2, PROG_GL3, PROG_GL4, PROJECT, PROJECTION, QUAD, QUAD_STRIP, QUADRATIC, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, STATIC, STREAM, SUBTRACT, SW, TAB, TARGA, TEXT, TEXTURE2D, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TRILINEAR, 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
BACKGROUND_ALPHA, CG_CONTEXT, CG_EFFECT, CG_PROGRAM, COLOR, DOUBLE, FLOAT, FRAGMENT_PROGRAM, GEOMETRY_PROGRAM, GL_DEPTH_STENCIL, GL_DEPTH24_STENCIL8, GL_FRAME_BUFFER, GL_PIXEL_BUFFER, GL_RENDER_BUFFER, GL_TEXTURE_OBJECT, GL_UNSIGNED_INT_24_8, GL_VERTEX_BUFFER, GLGRAPHICS, GLSL_PROGRAM, GLSL_SHADER, IDENTITY_MATRIX, INVERSE_MATRIX, INVERSE_TRANSPOSE_MATRIX, LINE_ADJACENCY, LINEAR_MIPMAP_LINEAR, LINEAR_MIPMAP_NEAREST, LINEAR_SAMPLING, NEAREST_MIPMAP_LINEAR, NEAREST_MIPMAP_NEAREST, NEAREST_SAMPLING, SHADER_VAR_ARRAY, SHADER_VAR_FLOAT, SHADER_VAR_INT, SHADER_VAR_MAT2, SHADER_VAR_MAT3, SHADER_VAR_MAT4, SHADER_VAR_MODELVIEW_MAT, SHADER_VAR_MODELVIEW_PROJECTION_MAT, SHADER_VAR_PROJECTION_MAT, SHADER_VAR_TEXTURE_MAT, SHADER_VAR_TEXTURE_SAMPLER, SHADER_VAR_VEC2, SHADER_VAR_VEC3, SHADER_VAR_VEC4, TEX_BYTE, TEX_INT, TEX_NORM, TEX_ONEDIM, TEX_RECT, TRANSPOSE_MATRIX, TRIANGLE_ADJACENCY, VERTEX_PROGRAM
 
Constructor Summary
GLTexture()
          Default constructor.
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, GLTextureParameters params, int id)
           
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
 void addPixelsToBuffer(java.lang.Object natBuf, java.nio.IntBuffer rgbBuf, int w, int h)
          This is the method used by the pixel source object to add frames to the buffer.
 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 copy(GLTexture src)
          Copy src texture into this.
 void delete()
           
 void delPixelsWhenBufferFull(boolean v)
          Determines the behavior of the buffering.
 void enableFastTextureLoad()
          Creates a Pixel Buffer Object (PBO) to allow for faster transfers of pixel data in GPU memory (EXPERIMENTAL).
 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 destA)
          Applies filter texFilter using this texture as source, destTex as multiple destinations and destA as the destination alpha value constant for the filter.
 void filter(GLTextureFilter texFilter, GLTexture[] destTexArray, float destA, float[]... values)
          Applies filter texFilter using this texture as source, destTex as multiple destinations and destA as the destination alpha value for the filter.
 void filter(GLTextureFilter texFilter, GLTexture destTex, float destA)
          Applies filter texFilter using this texture as source, destTex as destination and destA as the destination alpha value 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 destA, float[]... values)
          Applies filter texFilter using this texture as source, destTex as destination and destA as the destination alpha value for the filter.
 void getBuffer(float[] floatArray, int nchan)
          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.
 java.lang.String getName()
          Returns the name of the texture.
 int getPixelBufferUse()
          Returns how many frames are currently stored in the pixel buffer.
 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.
 int getTextureUnit()
          Returns the texture unit this texture is currently bound to.
 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 loadTextureFast()
          Copy pixels to texture using PBO.
 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 nchan)
          Copies floatArray into the texture, using the specified number of channels.
 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 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.
 boolean putPixelsIntoTexture()
          If there are frames stored in the buffer, it removes the last and copies the pixels to the texture.
 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 render(PGraphicsOpenGL renderer, 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) and using the specified renderer.
 void render(PGraphicsOpenGL renderer, float x, float y, float w, float h, float sx, float ty, float sw, float th)
           
 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 setName(java.lang.String str)
          Sets the name of the texture.
 void setPixelBufferSize(int n)
          Sets the size of the pixel buffer, in number of frames.
 void setPixelSource(java.lang.Object obj)
          Sets obj as the pixel source for this texture.
 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, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getParams, init, isModified, loadPixels, mask, mask, removeCache, removeParams, resize, save, set, set, setCache, setModified, setModified, setParams, updatePixels, updatePixels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GLTexture

public GLTexture()
Default constructor.


GLTexture

public GLTexture(processing.core.PApplet parent)
Creates an instance of GLTexture with size 1x1. The texture is not initialized.

Parameters:
parent - PApplet

GLTexture

public GLTexture(processing.core.PApplet parent,
                 int width,
                 int height)
Creates an instance of GLTexture with size width x height. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
width - int
height - int

GLTexture

public 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. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
width - int
height - int
params - GLTextureParameters

GLTexture

public 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. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
width - int
heigh - int
format - int

GLTexture

public 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. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
width - int
height - int
format - int
filter - int

GLTexture

public GLTexture(processing.core.PApplet parent,
                 java.lang.String filename)
Creates an instance of GLTexture using image file filename as source.

Parameters:
parent - PApplet
filename - String

GLTexture

public GLTexture(processing.core.PApplet parent,
                 int width,
                 int height,
                 GLTextureParameters params,
                 int id)

GLTexture

public 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.

Parameters:
parent - PApplet
filename - String
params - GLTextureParameters

GLTexture

public 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.

Parameters:
parent - PApplet
filename - String
format - int

GLTexture

public 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.

Parameters:
parent - PApplet
filename - String
format - int
filter - int

GLTexture

public 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. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
size - int

GLTexture

public 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. The texture is initialized (empty) to that size.

Parameters:
parent - PApplet
size - int
params - GLTextureParameters
Method Detail

delete

public void delete()
Overrides:
delete in class processing.core.PImage

init

public void init(int width,
                 int height)
Sets the size of the image and texture to width x height. If the texture is already initialized, it first destroys the current opengl texture object and then creates a new one with the specified size.

Parameters:
width - int
height - int

init

public 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. If the texture is already initialized, it first destroys the current opengl texture object and then creates a new one with the specified size.

Parameters:
width - int
height - int
params - GLTextureParameters

available

public boolean available()
Returns true if the texture has been initialized.

Returns:
boolean

getName

public java.lang.String getName()
Returns the name of the texture.


setName

public void setName(java.lang.String str)
Sets the name of the texture.


getTextureID

public int getTextureID()
Provides the ID of the opegl texture object.

Returns:
int

getTextureUnit

public int getTextureUnit()
Returns the texture unit this texture is currently bound to.

Returns:
int

getTextureTarget

public int getTextureTarget()
Returns the texture target.

Returns:
int

getTextureInternalFormat

public int getTextureInternalFormat()
Returns the texture internal format.

Returns:
int

getTextureMinFilter

public int getTextureMinFilter()
Returns the texture minimization filter.

Returns:
int

getTextureMagFilter

public int getTextureMagFilter()
Returns the texture magnification filter.

Returns:
int

usingMipmaps

public boolean usingMipmaps()
Returns true or false whether or not the texture is using mipmaps.

Returns:
boolean

getMaxTextureCoordS

public float getMaxTextureCoordS()
Returns the maximum possible value for the texture coordinate S.

Returns:
float

getMaxTextureCoordT

public float getMaxTextureCoordT()
Returns the maximum possible value for the texture coordinate T.

Returns:
float

isFlippedX

public boolean isFlippedX()
Returns true if the texture is flipped along the horizontal direction.

Returns:
boolean;

setFlippedX

public void setFlippedX(boolean v)
Sets the texture as flipped or not flipped on the horizontal direction.

Parameters:
v - boolean;

isFlippedY

public boolean isFlippedY()
Returns true if the texture is flipped along the vertical direction.

Returns:
boolean;

setFlippedY

public void setFlippedY(boolean v)
Sets the texture as flipped or not flipped on the vertical direction.

Parameters:
v - boolean;

putImage

public void putImage(processing.core.PImage img)
Puts img into texture, pixels and image.

Parameters:
img - PImage

putImage

public void putImage(processing.core.PImage img,
                     int format)
Puts img into texture, pixels and image.

Parameters:
img - PImage
format - int

putImage

public void putImage(processing.core.PImage img,
                     int format,
                     int filter)
Puts img into texture, pixels and image.

Parameters:
img - PImage
format - int
filter - int

putImage

public void putImage(processing.core.PImage img,
                     GLTextureParameters params)
Puts img into texture, pixels and image.

Parameters:
img - PImage
params - GLTextureParameters

putPixelsIntoTexture

public void putPixelsIntoTexture(processing.core.PImage img)
Puts pixels of img into texture only.

Parameters:
img - PImage

putPixelsIntoTexture

public 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.

Parameters:
img - PImage
x - int
y - int
w - int
h - int

getImage

public void getImage(processing.core.PImage img)
Copies texture to img.

Parameters:
img - PImage

loadTexture

public void loadTexture(java.lang.String filename)
Load texture, pixels and image from file.

Parameters:
filename - String

loadTexture

public void loadTexture(java.lang.String filename,
                        GLTextureParameters params)
Load texture, pixels and image from file using the specified texture parameters.

Parameters:
filename - String
params - GLTextureParameters

loadTexture

public void loadTexture(java.lang.String filename,
                        int format)
Load texture, pixels and image from file using the specified texture format.

Parameters:
filename - String
format - int

loadTexture

public void loadTexture(java.lang.String filename,
                        int format,
                        int filter)
Load texture, pixels and image from file using the specified texture format and filtering.

Parameters:
filename - String
format - int
filter - int

loadTexture

public void loadTexture()
Copy pixels to texture (loadPixels should have been called beforehand).


copy

public void copy(GLTexture src)
Copy src texture into this.

Parameters:
src - GLTexture

loadTextureFast

public void loadTextureFast()
Copy pixels to texture using PBO. TODO: Make this work for some release 1.x (perhaps). Or just remove.


enableFastTextureLoad

public void enableFastTextureLoad()
Creates a Pixel Buffer Object (PBO) to allow for faster transfers of pixel data in GPU memory (EXPERIMENTAL). For a detailed tutorial on PBOs look at: http://www.songho.ca/opengl/gl_pbo.html


updateTexture

public void updateTexture()
Copy texture to pixels (doesn't call updatePixels).


filter

public void filter(GLTextureFilter texFilter,
                   GLTexture destTex)
Applies filter texFilter using this texture as source and destTex as destination.

Parameters:
texFilter - GLTextureFilter
destTex - GLTexture

filter

public void filter(GLTextureFilter texFilter,
                   GLTexture destTex,
                   float[]... values)
Applies filter texFilter using this texture as source and destTex as destination. Sets all the value for all the parameters, by means of a parameter list of variable length. values is an array of float[].

Parameters:
texFilter - GLTextureFilter
destTex - GLTexture
float[] - values

filter

public void filter(GLTextureFilter texFilter,
                   GLTexture destTex,
                   float destA)
Applies filter texFilter using this texture as source, destTex as destination and destA as the destination alpha value for the filter.

Parameters:
texFilter - GLTextureFilter
destTex - GLTexture
destA - float

filter

public void filter(GLTextureFilter texFilter,
                   GLTexture destTex,
                   float destA,
                   float[]... values)
Applies filter texFilter using this texture as source, destTex as destination and destA as the destination alpha value for the filter. Sets all the value for all the parameters, by means of a parameter list of variable length. values is an array of float[].

Parameters:
texFilter - GLTextureFilter
destTex - GLTexture
destA - float
float[] - values

filter

public void filter(GLTextureFilter texFilter,
                   GLTexture[] destTexArray,
                   float destA)
Applies filter texFilter using this texture as source, destTex as multiple destinations and destA as the destination alpha value constant for the filter.

Parameters:
texFilter - GLTextureFilter
destTexArray - GLTexture[]
destA - float

filter

public void filter(GLTextureFilter texFilter,
                   GLTexture[] destTexArray,
                   float destA,
                   float[]... values)
Applies filter texFilter using this texture as source, destTex as multiple destinations and destA as the destination alpha value for the filter. Sets all the value for all the parameters, by means of a parameter list of variable length. values is an array of float[].

Parameters:
texFilter - GLTextureFilter
destTexArray - GLTexture[]
destA - float
float[] - values

render

public void render()
Draws the texture using the opengl commands, inside a rectangle located at the origin with the original size of the texture.


render

public 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.

Parameters:
x - float
y - float

render

public 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).

Parameters:
x - float
y - float
w - float
h - float

render

public void render(PGraphicsOpenGL renderer,
                   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) and using the specified renderer.

Parameters:
renderer - PGraphicsOpenGL
x - float
y - float
w - float
h - float

render

public void render(PGraphicsOpenGL renderer,
                   float x,
                   float y,
                   float w,
                   float h,
                   float sx,
                   float ty,
                   float sw,
                   float th)

putBuffer

public void putBuffer(int[] intArray)
Copies intArray into the texture, assuming that the array contains 4 color components and pixels are unsigned bytes.

Parameters:
intArray - int[]

putBuffer

public void putBuffer(int[] intArray,
                      int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are unsigned bytes.

Parameters:
intArray - int[]
format - int

putByteBuffer

public void putByteBuffer(int[] intArray,
                          int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are unsigned bytes.

Parameters:
intArray - int[]
format - int

putIntBuffer

public void putIntBuffer(int[] intArray,
                         int format)
Copies intArray into the texture, using the specified format and assuming that the pixels are integers.

Parameters:
intArray - int[]
format - int

putBuffer

public void putBuffer(int[] intArray,
                      int format,
                      int type)
Copies intArray into the texture, using the format and type specified.

Parameters:
intArray - int[]
format - int
type - int

putBuffer

public void putBuffer(float[] floatArray)
Copies floatArray into the texture, assuming that the array has 4 components.

Parameters:
floatArray - float[]
format - int

putBuffer

public void putBuffer(float[] floatArray,
                      int nchan)
Copies floatArray into the texture, using the specified number of channels.

Parameters:
floatArray - float[]
nchan - int

getBuffer

public void getBuffer(int[] intArray)
Copies the texture into intArray, assuming that the array has 4 components and the pixels are unsigned bytes.

Parameters:
intArray - int[]

getBuffer

public void getBuffer(int[] intArray,
                      int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are unsigned bytes.

Parameters:
intArray - int[]
format - nchan

getByteBuffer

public void getByteBuffer(int[] intArray,
                          int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are unsigned bytes.

Parameters:
intArray - int[]
format - int

getIntBuffer

public void getIntBuffer(int[] intArray,
                         int format)
Copies the texture into intArray, using the specified format and assuming that the pixels are integers.

Parameters:
intArray - int[]
format - int

getBuffer

public void getBuffer(int[] intArray,
                      int format,
                      int type)
Copies the texture into intArray, using the specified format and type. The resulting array is not reordered into ARGB, it follows OpenGL color component ordering (for instance, for 4 components, little-endian this would be ABGR). Perhaps ordering should be done automatically?

Parameters:
intArray - int[]
format - int
type - int

getBuffer

public void getBuffer(float[] floatArray,
                      int nchan)
Copies the texture into floatArray.

Parameters:
floatArray - float[]
format - nchan

setRandom

public 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.

Parameters:
r0 - float
r1 - float
g0 - float
g1 - float
b0 - float
b1 - float
a0 - float
a1 - float

setRandomDir2D

public 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.

Parameters:
r0 - float
r1 - float
phi0 - float
phi1 - float

setRandomDir3D

public 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.

Parameters:
r0 - float
r1 - float
phi0 - float
phi1 - float
theta0 - float
theta1 - float

setValue

public void setValue(float r,
                     float g,
                     float b,
                     float a)
Sets the texture to have the same given float value in each component.

Parameters:
r - float
g - float
b - float
a - float

setZero

public void setZero()
Sets to zero all the pixels of the texture.


clear

public void clear(int gray)
Fills the texture with the specified gray tone.

Parameters:
gray - int

clear

public void clear(float gray)
Fills the texture with the specified gray tone.

Parameters:
gray - float

clear

public void clear(int gray,
                  int alpha)
Fills the texture with the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

clear

public void clear(int rgb,
                  float alpha)
Fills the texture with the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

clear

public void clear(float gray,
                  float alpha)
Fills the texture with the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

clear

public void clear(int x,
                  int y,
                  int z)
Fills the texture with the specified color components.

Parameters:
x - int
y - int
z - int

clear

public void clear(float x,
                  float y,
                  float z)
Fills the texture with the specified color components.

Parameters:
x - float
y - float
z - float

clear

public void clear(int x,
                  int y,
                  int z,
                  int a)
Fills the texture with the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

clear

public void clear(float x,
                  float y,
                  float z,
                  float a)
Fills the texture with the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

paint

public void paint(int gray)
Paints the texture with the specified gray tone.

Parameters:
gray - int

paint

public void paint(float gray)
Paints the texture with the specified gray tone.

Parameters:
gray - float

paint

public void paint(int gray,
                  int alpha)
Paints the texture with the specified gray tone and alpha value.

Parameters:
gray - int
alpha - int

paint

public void paint(int rgb,
                  float alpha)
Paints the texture with the specified rgb color and alpha value.

Parameters:
rgb - int
alpha - float

paint

public void paint(float gray,
                  float alpha)
Paints the texture with the specified gray tone and alpha value.

Parameters:
gray - float
alpha - float

paint

public void paint(int x,
                  int y,
                  int z)
Paints the texture with the specified color components.

Parameters:
x - int
y - int
z - int

paint

public void paint(float x,
                  float y,
                  float z)
Paints the texture with the specified color components.

Parameters:
x - float
y - float
z - float

paint

public void paint(int x,
                  int y,
                  int z,
                  int a)
Paints the texture with the specified color components and alpha component.

Parameters:
x - int
y - int
z - int
a - int

paint

public void paint(float x,
                  float y,
                  float z,
                  float a)
Paints the texture with the specified color components and alpha component.

Parameters:
x - float
y - float
z - float
a - float

setPixelSource

public void setPixelSource(java.lang.Object obj)
Sets obj as the pixel source for this texture. The object must have a public method called disposeBuffer(Object obj) that the texture will use to release the int buffers after they are copied to the texture.

Parameters:
obj - Object

putPixelsIntoTexture

public boolean putPixelsIntoTexture()
If there are frames stored in the buffer, it removes the last and copies the pixels to the texture. It returns true if that is the case, otherwise it returns false.

Returns:
boolean

setPixelBufferSize

public void setPixelBufferSize(int n)
Sets the size of the pixel buffer, in number of frames. When this size is reached, new frames are dropped.

Parameters:
n - int

getPixelBufferUse

public int getPixelBufferUse()
Returns how many frames are currently stored in the pixel buffer.


delPixelsWhenBufferFull

public void delPixelsWhenBufferFull(boolean v)
Determines the behavior of the buffering. When the argument is true, then new frames are disposed when the buffer is already full, otherwise they are not. In the later case, and depending on how the buffer generation method works, might result in the buffers being stored somewhere else and being resent later.


addPixelsToBuffer

public void addPixelsToBuffer(java.lang.Object natBuf,
                              java.nio.IntBuffer rgbBuf,
                              int w,
                              int h)
This is the method used by the pixel source object to add frames to the buffer.

Parameters:
natBuf - Object
rgbBuf - IntBuffer
w - int
h - int


processing library GLGraphics by Andres Colubri. (c) 2008-2011