Package com.badlogic.gdx.graphics
Interface TextureData
-
- All Known Implementing Classes:
ETC1TextureData
,FileTextureData
,FloatTextureData
,GLOnlyTextureData
,KTXTextureData
,MipMapTextureData
,PixmapTextureData
public interface TextureData
Used by aTexture
to load the pixel data. A TextureData can either return aPixmap
or upload the pixel data itself. It signals it's type viagetType()
to the Texture that's using it. The Texture will then either invokeconsumePixmap()
orconsumeCustomData(int)
. These are the first methods to be called by Texture. After that the Texture will invoke the other methods to find out about the size of the image data, the format, whether mipmaps should be generated and whether the TextureData is able to manage the pixel data if the OpenGL ES context is lost. In case the TextureData implementation has the typeTextureData.TextureDataType.Custom
, the implementation has to generate the mipmaps itself if necessary. SeeMipMapGenerator
. Before a call to eitherconsumePixmap()
orconsumeCustomData(int)
, Texture will bind the OpenGL ES texture. Look atFileTextureData
andETC1TextureData
for example implementations of this interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TextureData.Factory
Provides static method to instantiate the right implementation (Pixmap, ETC1, KTX).static class
TextureData.TextureDataType
The type of thisTextureData
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
consumeCustomData(int target)
Uploads the pixel data to the OpenGL ES texture.Pixmap
consumePixmap()
Returns thePixmap
for upload by Texture.boolean
disposePixmap()
Pixmap.Format
getFormat()
int
getHeight()
TextureData.TextureDataType
getType()
int
getWidth()
boolean
isManaged()
boolean
isPrepared()
void
prepare()
Prepares the TextureData for a call toconsumePixmap()
orconsumeCustomData(int)
.boolean
useMipMaps()
-
-
-
Method Detail
-
getType
TextureData.TextureDataType getType()
- Returns:
- the
TextureData.TextureDataType
-
isPrepared
boolean isPrepared()
- Returns:
- whether the TextureData is prepared or not.
-
prepare
void prepare()
Prepares the TextureData for a call toconsumePixmap()
orconsumeCustomData(int)
. This method can be called from a non OpenGL thread and should thus not interact with OpenGL.
-
consumePixmap
Pixmap consumePixmap()
Returns thePixmap
for upload by Texture. A call toprepare()
must precede a call to this method. Any internal data structures created inprepare()
should be disposed of here.- Returns:
- the pixmap.
-
disposePixmap
boolean disposePixmap()
- Returns:
- whether the caller of
consumePixmap()
should dispose the Pixmap returned byconsumePixmap()
-
consumeCustomData
void consumeCustomData(int target)
-
getWidth
int getWidth()
- Returns:
- the width of the pixel data
-
getHeight
int getHeight()
- Returns:
- the height of the pixel data
-
getFormat
Pixmap.Format getFormat()
- Returns:
- the
Pixmap.Format
of the pixel data
-
useMipMaps
boolean useMipMaps()
- Returns:
- whether to generate mipmaps or not.
-
isManaged
boolean isManaged()
- Returns:
- whether this implementation can cope with a EGL context loss.
-
-