public class TextureData extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TextureData.ColorSpace
ColorSpace of pixel data.
|
static interface |
TextureData.Flusher
Defines a callback mechanism to allow the user to explicitly
deallocate native resources (memory-mapped files, etc.)
associated with a particular TextureData.
|
Constructor and Description |
---|
TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
int border,
GLPixelBuffer.GLPixelAttributes pixelAttributes,
boolean mipmap,
boolean dataIsCompressed,
boolean mustFlipVertically,
Buffer buffer,
TextureData.Flusher flusher)
Constructs a new TextureData object with the specified parameters
and data contained in the given Buffer.
|
TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
int border,
GLPixelBuffer.GLPixelAttributes pixelAttributes,
boolean dataIsCompressed,
boolean mustFlipVertically,
Buffer[] mipmapData,
TextureData.Flusher flusher)
Constructs a new TextureData object with the specified parameters
and data for multiple mipmap levels contained in the given array
of Buffers.
|
TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
int border,
int pixelFormat,
int pixelType,
boolean mipmap,
boolean dataIsCompressed,
boolean mustFlipVertically,
Buffer buffer,
TextureData.Flusher flusher)
Constructs a new TextureData object with the specified parameters
and data contained in the given Buffer.
|
TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
int border,
int pixelFormat,
int pixelType,
boolean dataIsCompressed,
boolean mustFlipVertically,
Buffer[] mipmapData,
TextureData.Flusher flusher)
Constructs a new TextureData object with the specified parameters
and data for multiple mipmap levels contained in the given array
of Buffers.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Calls flush()
|
void |
flush()
Flushes resources associated with this TextureData by calling
Flusher.flush().
|
int |
getAlignment()
Returns the required byte alignment for the texture data.
|
int |
getBorder()
Returns the border in pixels of the texture data.
|
Buffer |
getBuffer()
Returns the texture data, or null if it is specified as a set of mipmaps.
|
TextureData.ColorSpace |
getColorSpace()
Returns the color space of the pixel data.
|
int |
getEstimatedMemorySize()
Returns an estimate of the amount of memory in bytes this
TextureData will consume once uploaded to the graphics card.
|
GLProfile |
getGLProfile()
Returns the GLProfile this texture data is intended and created for.
|
int |
getHeight()
Returns the height in pixels of the texture data.
|
int |
getInternalFormat()
Returns the intended OpenGL internal format of the texture data.
|
boolean |
getMipmap()
Returns whether mipmaps should be generated for the texture data.
|
Buffer[] |
getMipmapData()
Returns all mipmap levels for the texture data, or null if it is
specified as a single image.
|
boolean |
getMustFlipVertically()
Indicates whether the texture coordinates must be flipped
vertically for proper display.
|
GLPixelBuffer.GLPixelAttributes |
getPixelAttributes()
Returns the intended OpenGL
GLPixelBuffer.GLPixelAttributes of the texture data, i.e. |
int |
getPixelFormat()
Returns the intended OpenGL pixel format of the texture data using
getPixelAttributes() . |
int |
getPixelType()
Returns the intended OpenGL pixel type of the texture data using
getPixelAttributes() . |
int |
getRowLength()
Returns the row length needed for correct GL_UNPACK_ROW_LENGTH
specification.
|
int |
getWidth()
Returns the width in pixels of the texture data.
|
boolean |
isDataCompressed()
Indicates whether the texture data is in compressed form.
|
void |
setAlignment(int alignment)
Sets the required byte alignment for the texture data.
|
void |
setBorder(int border)
Sets the border in pixels of the texture data.
|
void |
setBuffer(Buffer buffer)
Sets the texture data.
|
void |
setColorSpace(TextureData.ColorSpace cs)
Set the color space of the pixel data, which defaults to
TextureData.ColorSpace.RGB . |
void |
setHaveEXTABGR(boolean haveEXTABGR)
Indicates to this TextureData whether the GL_EXT_abgr extension
is available.
|
void |
setHaveGL12(boolean haveGL12)
Indicates to this TextureData whether OpenGL version 1.2 is
available.
|
void |
setHeight(int height)
Sets the height in pixels of the texture data.
|
void |
setInternalFormat(int internalFormat)
Sets the intended OpenGL internal format of the texture data.
|
void |
setIsDataCompressed(boolean compressed)
Sets whether the texture data is in compressed form.
|
void |
setMipmap(boolean mipmap)
Sets whether mipmaps should be generated for the texture data.
|
void |
setMustFlipVertically(boolean mustFlipVertically)
Sets whether the texture coordinates must be flipped vertically
for proper display.
|
void |
setPixelAttributes(GLPixelBuffer.GLPixelAttributes pixelAttributes)
Sets the intended OpenGL pixel format of the texture data.
|
void |
setPixelFormat(int pixelFormat)
Sets the intended OpenGL pixel format component of
GLPixelBuffer.GLPixelAttributes of the texture data. |
void |
setPixelType(int pixelType)
Sets the intended OpenGL pixel type component of
GLPixelBuffer.GLPixelAttributes of the texture data. |
void |
setRowLength(int rowLength)
Sets the row length needed for correct GL_UNPACK_ROW_LENGTH
specification.
|
void |
setWidth(int width)
Sets the width in pixels of the texture data.
|
String |
toString() |
public TextureData(GLProfile glp, 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
glp
- the OpenGL Profile this texture data should be
created for.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()IllegalArgumentException
- if any parameters of the texture
data were invalid, such as requesting mipmap generation for a
compressed texturepublic TextureData(GLProfile glp, int internalFormat, int width, int height, int border, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean mipmap, boolean dataIsCompressed, boolean mustFlipVertically, Buffer buffer, TextureData.Flusher flusher) throws IllegalArgumentException
glp
- the OpenGL Profile this texture data should be
created for.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)pixelAttributes
- the OpenGL pixel format and type for the
resulting texture; must be specified, may
not be 0mipmap
- 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()IllegalArgumentException
- if any parameters of the texture
data were invalid, such as requesting mipmap generation for a
compressed texturepublic TextureData(GLProfile glp, int internalFormat, int width, int height, int border, int pixelFormat, int pixelType, boolean dataIsCompressed, boolean mustFlipVertically, Buffer[] mipmapData, TextureData.Flusher flusher) throws IllegalArgumentException
glp
- the OpenGL Profile this texture data should be
created for.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()IllegalArgumentException
- if any parameters of the texture
data were invalid, such as requesting mipmap generation for a
compressed texturepublic TextureData(GLProfile glp, int internalFormat, int width, int height, int border, GLPixelBuffer.GLPixelAttributes pixelAttributes, boolean dataIsCompressed, boolean mustFlipVertically, Buffer[] mipmapData, TextureData.Flusher flusher) throws IllegalArgumentException
glp
- the OpenGL Profile this texture data should be
created for.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)pixelAttributes
- the OpenGL pixel format and type for the
resulting texture; must be specified, may
not be 0dataIsCompressed
- 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()IllegalArgumentException
- if any parameters of the texture
data were invalid, such as requesting mipmap generation for a
compressed texturepublic TextureData.ColorSpace getColorSpace()
setColorSpace(ColorSpace)
public void setColorSpace(TextureData.ColorSpace cs)
TextureData.ColorSpace.RGB
.getColorSpace()
public int getWidth()
public int getHeight()
public int getBorder()
public GLPixelBuffer.GLPixelAttributes getPixelAttributes()
GLPixelBuffer.GLPixelAttributes
of the texture data, i.e. format and type.public int getPixelFormat()
getPixelAttributes()
.public int getPixelType()
getPixelAttributes()
.public int getInternalFormat()
public boolean getMipmap()
public boolean isDataCompressed()
public boolean getMustFlipVertically()
public Buffer getBuffer()
public Buffer[] getMipmapData()
public int getAlignment()
public int getRowLength()
public void setWidth(int width)
public void setHeight(int height)
public void setBorder(int border)
public void setPixelAttributes(GLPixelBuffer.GLPixelAttributes pixelAttributes)
public void setPixelFormat(int pixelFormat)
GLPixelBuffer.GLPixelAttributes
of the texture data.
Use #setPixelAttributes(GLPixelAttributes)
, if setting format and type.
public void setPixelType(int pixelType)
GLPixelBuffer.GLPixelAttributes
of the texture data.
Use #setPixelAttributes(GLPixelAttributes)
, if setting format and type.
public void setInternalFormat(int internalFormat)
public void setMipmap(boolean mipmap)
public void setIsDataCompressed(boolean compressed)
public void setMustFlipVertically(boolean mustFlipVertically)
public void setBuffer(Buffer buffer)
public void setAlignment(int alignment)
public void setRowLength(int rowLength)
public void setHaveEXTABGR(boolean haveEXTABGR)
public void setHaveGL12(boolean haveGL12)
public GLProfile getGLProfile()
public int getEstimatedMemorySize()
public void flush()
public void destroy()
flush()
Copyright 2010 JogAmp Community.