public class Texture extends Object implements PConstants
Modifier and Type | Class and Description |
---|---|
static class |
Texture.Parameters
This class stores the parameters for a texture: target, internal format,
minimization filter and magnification filter.
|
Modifier and Type | Field and Description |
---|---|
int |
glFormat |
int |
glHeight |
int |
glMagFilter |
int |
glMinFilter |
int |
glName |
int |
glTarget |
int |
glWidth |
int |
glWrapS |
int |
glWrapT |
int |
height |
static int |
MAX_BUFFER_CACHE_SIZE |
int |
width |
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
Texture(PGraphicsOpenGL pg) |
Texture(PGraphicsOpenGL pg,
int width,
int height)
Creates an instance of PTexture with size width x height.
|
Texture(PGraphicsOpenGL pg,
int width,
int height,
Object params)
Creates an instance of PTexture with size width x height and with the
specified parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
available()
Returns true if the texture has been initialized.
|
void |
bind() |
boolean |
bound() |
boolean |
colorBuffer() |
void |
colorBuffer(boolean value) |
void |
copyBufferFromSource(Object natRef,
ByteBuffer byteBuf,
int w,
int h) |
int |
currentSampling() |
void |
disposeSourceBuffer() |
void |
get(int[] pixels)
Copy texture to pixels.
|
void |
getBufferPixels(int[] pixels) |
int |
getModifiedX1() |
int |
getModifiedX2() |
int |
getModifiedY1() |
int |
getModifiedY2() |
Texture.Parameters |
getParameters() |
boolean |
hasBuffers() |
boolean |
hasBufferSource() |
void |
init(int width,
int height)
Sets the size of the image and texture to width x height.
|
void |
init(int width,
int height,
int glName,
int glTarget,
int glFormat,
int glWidth,
int glHeight,
int glMinFilter,
int glMagFilter,
int glWrapS,
int glWrapT)
Initializes the texture using GL parameters
|
void |
init(int width,
int height,
Texture.Parameters params)
Sets the size of the image and texture to width x height, and the
parameters of the texture to params.
|
boolean |
invertedX()
Returns true if the texture is inverted along the horizontal direction.
|
void |
invertedX(boolean v)
Sets the texture as inverted or not along the horizontal direction.
|
boolean |
invertedY()
Returns true if the texture is inverted along the vertical direction.
|
void |
invertedY(boolean v)
Sets the texture as inverted or not along the vertical direction.
|
boolean |
isModified() |
float |
maxTexcoordU()
Returns the maximum possible value for the texture coordinate U
(horizontal).
|
float |
maxTexcoordV()
Returns the maximum possible value for the texture coordinate V (vertical).
|
void |
put(int texTarget,
int texName,
int texWidth,
int texHeight,
int w,
int h) |
void |
put(int texTarget,
int texName,
int texWidth,
int texHeight,
int target,
int tex,
int x,
int y,
int w,
int h) |
void |
put(Texture tex) |
void |
put(Texture tex,
int x,
int y,
int w,
int h) |
void |
resize(int wide,
int high) |
void |
set(int[] pixels) |
void |
set(int[] pixels,
int format) |
void |
set(int[] pixels,
int x,
int y,
int w,
int h) |
void |
set(int[] pixels,
int x,
int y,
int w,
int h,
int format) |
void |
set(int texTarget,
int texName,
int texWidth,
int texHeight,
int w,
int h) |
void |
set(int texTarget,
int texName,
int texWidth,
int texHeight,
int target,
int tex,
int x,
int y,
int w,
int h) |
void |
set(Texture tex) |
void |
set(Texture tex,
int x,
int y,
int w,
int h) |
void |
setBufferSource(Object source) |
void |
setModified() |
void |
setModified(boolean m) |
void |
setNative(int[] pixels) |
void |
setNative(int[] pixels,
int x,
int y,
int w,
int h) |
void |
setNative(IntBuffer pixBuf,
int x,
int y,
int w,
int h) |
void |
unbind() |
void |
updateTexels() |
void |
updateTexels(int x,
int y,
int w,
int h) |
boolean |
usingMipmaps()
Returns true or false whether or not the texture is using mipmaps.
|
void |
usingMipmaps(boolean mipmaps,
int sampling) |
boolean |
usingRepeat()
Returns true or false whether or not the texture is using repeat wrap mode
along either U or V directions.
|
void |
usingRepeat(boolean repeat) |
public int width
public int height
public int glName
public int glTarget
public int glFormat
public int glMinFilter
public int glMagFilter
public int glWrapS
public int glWrapT
public int glWidth
public int glHeight
public static final int MAX_BUFFER_CACHE_SIZE
public Texture(PGraphicsOpenGL pg)
public Texture(PGraphicsOpenGL pg, int width, int height)
width
- intheight
- intpublic Texture(PGraphicsOpenGL pg, int width, int height, Object params)
width
- intheight
- intparams
- Parameterspublic void init(int width, int height)
width
- intheight
- intpublic void init(int width, int height, Texture.Parameters params)
width
- intheight
- intparams
- GLTextureParameterspublic void init(int width, int height, int glName, int glTarget, int glFormat, int glWidth, int glHeight, int glMinFilter, int glMagFilter, int glWrapS, int glWrapT)
public void resize(int wide, int high)
public boolean available()
public void set(Texture tex)
public void set(Texture tex, int x, int y, int w, int h)
public void set(int texTarget, int texName, int texWidth, int texHeight, int w, int h)
public void set(int texTarget, int texName, int texWidth, int texHeight, int target, int tex, int x, int y, int w, int h)
public void set(int[] pixels)
public void set(int[] pixels, int format)
public void set(int[] pixels, int x, int y, int w, int h)
public void set(int[] pixels, int x, int y, int w, int h, int format)
public void setNative(int[] pixels)
public void setNative(int[] pixels, int x, int y, int w, int h)
public void setNative(IntBuffer pixBuf, int x, int y, int w, int h)
public void get(int[] pixels)
public void put(Texture tex)
public void put(Texture tex, int x, int y, int w, int h)
public void put(int texTarget, int texName, int texWidth, int texHeight, int w, int h)
public void put(int texTarget, int texName, int texWidth, int texHeight, int target, int tex, int x, int y, int w, int h)
public boolean usingMipmaps()
public void usingMipmaps(boolean mipmaps, int sampling)
public boolean usingRepeat()
public void usingRepeat(boolean repeat)
public float maxTexcoordU()
public float maxTexcoordV()
public boolean invertedX()
public void invertedX(boolean v)
v
- boolean;public boolean invertedY()
public void invertedY(boolean v)
v
- boolean;public int currentSampling()
public void bind()
public void unbind()
public boolean bound()
public boolean isModified()
public void setModified()
public void setModified(boolean m)
public int getModifiedX1()
public int getModifiedX2()
public int getModifiedY1()
public int getModifiedY2()
public void updateTexels()
public void updateTexels(int x, int y, int w, int h)
public void setBufferSource(Object source)
public void copyBufferFromSource(Object natRef, ByteBuffer byteBuf, int w, int h)
public void disposeSourceBuffer()
public void getBufferPixels(int[] pixels)
public boolean hasBufferSource()
public boolean hasBuffers()
public void colorBuffer(boolean value)
public boolean colorBuffer()
public Texture.Parameters getParameters()