Package arc.graphics
Class Texture
java.lang.Object
arc.graphics.GLTexture
arc.graphics.Texture
- All Implemented Interfaces:
Disposable
A Texture wraps a standard OpenGL ES texture.
A Texture can be managed. If the OpenGL context is lost all managed textures get invalidated. This happens when a user switches to another application or receives an incoming call. Managed textures get reloaded automatically.
A Texture has to be bound via the GLTexture.bind()
method in order for it to be applied to geometry. The texture will be
bound to the currently active texture unit specified via GL20.glActiveTexture(int)
.
You can draw Pixmap
s to a texture at any time. The changes will be automatically uploaded to texture memory. This is of
course not extremely fast so use it with care. It also only works with unmanaged textures.
A Texture must be disposed when it is no longer used
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Texture()
For use in mocking only!Texture
(int width, int height) protected
Texture
(int glTarget, int glHandle, TextureData data) Texture
(TextureData data) -
Method Summary
Modifier and TypeMethodDescriptionstatic Texture
createEmpty
(TextureData data) void
void
Draws the givenPixmap
to the texture at position x, y.int
getDepth()
boolean
void
load
(TextureData data) toString()
Methods inherited from class arc.graphics.GLTexture
bind, bind, dispose, getMagFilter, getMinFilter, getTextureObjectHandle, getUWrap, getVWrap, setFilter, setFilter, setWrap, setWrap, unsafeSetFilter, unsafeSetFilter, unsafeSetWrap, unsafeSetWrap, uploadImageData, uploadImageData
-
Constructor Details
-
Texture
-
Texture
-
Texture
-
Texture
-
Texture
-
Texture
public Texture(int width, int height) -
Texture
-
Texture
protected Texture()For use in mocking only! -
Texture
-
-
Method Details
-
createEmpty
-
load
-
draw
-
draw
Draws the givenPixmap
to the texture at position x, y. No clipping is performed so you have to make sure that you draw only inside the texture region. Note that this will only draw to mipmap level 0!- Parameters:
pixmap
- The Pixmapx
- The x coordinate in pixelsy
- The y coordinate in pixels
-
getDepth
public int getDepth() -
getTextureData
-
isDisposed
public boolean isDisposed() -
toString
-