APIdia Launch Partner
Top Description Inners Methods
com.badlogic.gdx.graphics

public Interface TextureData

Known Direct Implementers
com.badlogic.gdx.graphics.glutils.ETC1TextureData, com.badlogic.gdx.graphics.glutils.FileTextureData, com.badlogic.gdx.graphics.glutils.FloatTextureData, com.badlogic.gdx.graphics.glutils.GLOnlyTextureData, com.badlogic.gdx.graphics.glutils.KTXTextureData, com.badlogic.gdx.graphics.glutils.MipMapTextureData, com.badlogic.gdx.graphics.glutils.PixmapTextureData
Imports
com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.Pixmap.Format, com.badlogic.gdx.graphics.glutils.ETC1TextureData, .FileTextureData, .KTXTextureData, .MipMapGenerator

Used by a Texture to load the pixel data. A TextureData can either return a Pixmap or upload the pixel data itself. It signals it's type via getType() to the Texture that's using it. The Texture will then either invoke consumePixmap() or consumeCustomData(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 type TextureDataType#Custom, the implementation has to generate the mipmaps itself if necessary. See MipMapGenerator.

Before a call to either consumePixmap() or consumeCustomData(int), Texture will bind the OpenGL ES texture.

Look at FileTextureData and ETC1TextureData for example implementations of this interface.
Author
mzechner

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TextureData.Factory

Provides static method to instantiate the right implementation (Pixmap, ETC1, KTX).

public static enum

Method Summary

Modifier and TypeMethod and Description
public void
consumeCustomData(int target)

Uploads the pixel data to the OpenGL ES texture.

public Pixmap

Returns:

the pixmap.
consumePixmap
()

Returns the Pixmap for upload by Texture.

public boolean
disposePixmap()

Returns: whether the caller of consumePixmap() should dispose the Pixmap returned by consumePixmap()

public Pixmap.Format
getFormat()

Returns: the Format of the pixel data

public int
getHeight()

Returns: the height of the pixel data

public TextureData.TextureDataType
getType()

Returns: the TextureDataType

public int
getWidth()

Returns: the width of the pixel data

public boolean
isManaged()

Returns: whether this implementation can cope with a EGL context loss.

public boolean
isPrepared()

Returns: whether the TextureData is prepared or not.

public void
prepare()

Prepares the TextureData for a call to consumePixmap() or consumeCustomData(int).

public boolean
useMipMaps()

Returns: whether to generate mipmaps or not.

Method Detail

consumeCustomDataback to summary
public void consumeCustomData(int target)

Uploads the pixel data to the OpenGL ES texture. The caller must bind an OpenGL ES texture. A call to prepare() must preceed a call to this method. Any internal data structures created in prepare() should be disposed of here.

consumePixmapback to summary
public Pixmap consumePixmap()

Returns the Pixmap for upload by Texture. A call to prepare() must precede a call to this method. Any internal data structures created in prepare() should be disposed of here.

Returns:Pixmap

the pixmap.

disposePixmapback to summary
public boolean disposePixmap()
Returns:boolean

whether the caller of consumePixmap() should dispose the Pixmap returned by consumePixmap()

getFormatback to summary
public Pixmap.Format getFormat()
Returns:Pixmap.Format

the Format of the pixel data

getHeightback to summary
public int getHeight()
Returns:int

the height of the pixel data

getTypeback to summary
public TextureData.TextureDataType getType()
Returns:TextureData.TextureDataType

the TextureDataType

getWidthback to summary
public int getWidth()
Returns:int

the width of the pixel data

isManagedback to summary
public boolean isManaged()
Returns:boolean

whether this implementation can cope with a EGL context loss.

isPreparedback to summary
public boolean isPrepared()
Returns:boolean

whether the TextureData is prepared or not.

prepareback to summary
public void prepare()

Prepares the TextureData for a call to consumePixmap() or consumeCustomData(int). This method can be called from a non OpenGL thread and should thus not interact with OpenGL.

useMipMapsback to summary
public boolean useMipMaps()
Returns:boolean

whether to generate mipmaps or not.

com.badlogic.gdx.graphics back to summary

public Class TextureData.Factory

extends Object
Class Inheritance

Provides static method to instantiate the right implementation (Pixmap, ETC1, KTX).
Author
Vincent Bousquet

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static TextureData
loadFromFile(FileHandle file, boolean useMipMaps)

public static TextureData
loadFromFile(FileHandle file, Pixmap.Format format, boolean useMipMaps)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Factoryback to summary
public Factory()

Method Detail

loadFromFileback to summary
public static TextureData loadFromFile(FileHandle file, boolean useMipMaps)
loadFromFileback to summary
public static TextureData loadFromFile(FileHandle file, Pixmap.Format format, boolean useMipMaps)
com.badlogic.gdx.graphics back to summary

public final Enum TextureData.TextureDataType

extends Enum<TextureData.TextureDataType>
Class Inheritance

The type of this TextureData.
Author
mzechner

Field Summary

Modifier and TypeField and Description
public static final TextureData.TextureDataType
public static final TextureData.TextureDataType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TextureData.TextureDataType
public static TextureData.TextureDataType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Customback to summary
public static final TextureData.TextureDataType Custom
Pixmapback to summary
public static final TextureData.TextureDataType Pixmap

Constructor Detail

TextureDataTypeback to summary
private TextureDataType()

Method Detail

valueOfback to summary
public static TextureData.TextureDataType valueOf(String name)
valuesback to summary
public static TextureData.TextureDataType[] values()