Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.sun.opengl.util.texture.TextureData
public class TextureData
extends Object
Nested Class Summary | |
static interface |
|
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
int |
|
int |
|
Buffer |
|
int |
|
int |
|
int |
|
boolean |
|
Buffer[] |
|
boolean |
|
int |
|
int |
|
int |
|
int |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public TextureData(int internalFormat, int pixelFormat, boolean mipmap, BufferedImage image)
Constructs a new TextureData object with the specified parameters and data contained in the given BufferedImage. The resulting TextureData "wraps" the contents of the BufferedImage, so if a modification is made to the BufferedImage between the time the TextureData is constructed and when a Texture is made from the TextureData, that modification will be visible in the resulting Texture.
- Parameters:
internalFormat
- the OpenGL internal format for the resulting texture; may be 0, in which case it is inferred from the image's typepixelFormat
- the OpenGL internal format for the resulting texture; may be 0, in which case it is inferred from the image's type (note: this argument is currently always ignored)mipmap
- indicates whether mipmaps should be autogenerated (using GLU) for the resulting textureimage
- the image containing the texture data
public TextureData(int internalFormat, int width, int height, int border, int pixelFormat, int pixelType, boolean dataIsCompressed, boolean mustFlipVertically, Buffer[] mipmapData, TextureData.Flusher flusher) throws IllegalArgumentException
Constructs a new TextureData object with the specified parameters and data for multiple mipmap levels contained in the given array of Buffers. The optional Flusher can be used to clean up native resources associated with this TextureData when processing is complete; for example, closing of memory-mapped files that might otherwise require a garbage collection to reclaim and close.
- Parameters:
internalFormat
- the OpenGL internal format for the resulting texture; must be specified, may not be 0width
- the width in pixels of the topmost mipmap level of the textureheight
- the height in pixels of the topmost mipmap level of the textureborder
- the number of pixels of border this texture data has (0 or 1)pixelFormat
- the OpenGL pixel format for the resulting texture; must be specified, may not be 0pixelType
- the OpenGL type of the pixels of the texturedataIsCompressed
- indicates whether the texture data is in compressed form (e.g. GL_COMPRESSED_RGB_S3TC_DXT1_EXT)mustFlipVertically
- indicates whether the texture coordinates must be flipped vertically in order to properly display the texturemipmapData
- the buffers containing all mipmap levels of the texture's dataflusher
- optional flusher to perform cleanup tasks upon call to flush()
public TextureData(int internalFormat, int width, int height, int border, int pixelFormat, int pixelType, boolean mipmap, boolean dataIsCompressed, boolean mustFlipVertically, Buffer buffer, TextureData.Flusher flusher) throws IllegalArgumentException
Constructs a new TextureData object with the specified parameters and data contained in the given Buffer. The optional Flusher can be used to clean up native resources associated with this TextureData when processing is complete; for example, closing of memory-mapped files that might otherwise require a garbage collection to reclaim and close.
- Parameters:
internalFormat
- the OpenGL internal format for the resulting texture; must be specified, may not be 0width
- the width in pixels of the textureheight
- the height in pixels of the textureborder
- the number of pixels of border this texture data has (0 or 1)pixelFormat
- the OpenGL pixel format for the resulting texture; must be specified, may not be 0pixelType
- the OpenGL type of the pixels of the texturemipmap
- indicates whether mipmaps should be autogenerated (using GLU) for the resulting texture. Currently if mipmap is true then dataIsCompressed may not be true.dataIsCompressed
- indicates whether the texture data is in compressed form (e.g. GL_COMPRESSED_RGB_S3TC_DXT1_EXT)mustFlipVertically
- indicates whether the texture coordinates must be flipped vertically in order to properly display the texturebuffer
- the buffer containing the texture dataflusher
- optional flusher to perform cleanup tasks upon call to flush()
public void flush()
Flushes resources associated with this TextureData by calling Flusher.flush().
public int getAlignment()
Returns the required byte alignment for the texture data.
public int getBorder()
Returns the border in pixels of the texture data.
public Buffer getBuffer()
Returns the texture data, or null if it is specified as a set of mipmaps.
public int getEstimatedMemorySize()
Returns an estimate of the amount of memory in bytes this TextureData will consume once uploaded to the graphics card. It should only be treated as an estimate; most applications should not need to query this but instead let the OpenGL implementation page textures in and out as necessary.
public int getHeight()
Returns the height in pixels of the texture data.
public int getInternalFormat()
Returns the intended OpenGL internal format of the texture data.
public boolean getMipmap()
Returns whether mipmaps should be generated for the texture data.
public Buffer[] getMipmapData()
Returns all mipmap levels for the texture data, or null if it is specified as a single image.
public boolean getMustFlipVertically()
Indicates whether the texture coordinates must be flipped vertically for proper display.
public int getPixelFormat()
Returns the intended OpenGL pixel format of the texture data.
public int getPixelType()
Returns the intended OpenGL pixel type of the texture data.
public int getRowLength()
Returns the row length needed for correct GL_UNPACK_ROW_LENGTH specification. This is currently only supported for non-mipmapped, non-compressed textures.
public int getWidth()
Returns the width in pixels of the texture data.
public boolean isDataCompressed()
Indicates whether the texture data is in compressed form.
public void setAlignment(int alignment)
Sets the required byte alignment for the texture data.
public void setBorder(int border)
Sets the border in pixels of the texture data.
public void setBuffer(Buffer buffer)
Sets the texture data.
public void setHaveEXTABGR(boolean haveEXTABGR)
Indicates to this TextureData whether the GL_EXT_abgr extension is available. Used for optimization along some code paths to avoid data copies.
public void setHaveGL12(boolean haveGL12)
Indicates to this TextureData whether OpenGL version 1.2 is available. If not, falls back to relatively inefficient code paths for several input data types (several kinds of packed pixel formats, in particular).
public void setHeight(int height)
Sets the height in pixels of the texture data.
public void setInternalFormat(int internalFormat)
Sets the intended OpenGL internal format of the texture data.
public void setIsDataCompressed(boolean compressed)
Sets whether the texture data is in compressed form.
public void setMipmap(boolean mipmap)
Sets whether mipmaps should be generated for the texture data.
public void setMustFlipVertically(boolean mustFlipVertically)
Sets whether the texture coordinates must be flipped vertically for proper display.
public void setPixelFormat(int pixelFormat)
Sets the intended OpenGL pixel format of the texture data.
public void setPixelType(int pixelType)
Sets the intended OpenGL pixel type of the texture data.
public void setRowLength(int rowLength)
Sets the row length needed for correct GL_UNPACK_ROW_LENGTH specification. This is currently only supported for non-mipmapped, non-compressed textures.
public void setWidth(int width)
Sets the width in pixels of the texture data.