public final class Texture
- Object
- Texture
A GPU texture. Instances are created by a
GraphicsDevice from a Codename
One Image or from raw ARGB pixel data and then referenced by a Material.
The class itself is a lightweight handle; the pixel storage lives on the GPU.Nested types
enum Texture.Wrap | The texture coordinate wrapping behavior outside the 0..1 range. |
enum Texture.Filter | The sampling filter applied when the texture is scaled. |
Constructors
public Texture(int width, int height) | Creates a texture handle of the given dimensions. |
Methods
public int getWidth() | Returns the texture width in pixels. |
public int getHeight() | Returns the texture height in pixels. |
public Texture.Wrap getWrap() | Returns the configured wrapping mode. |
public Texture setWrap(Texture.Wrap wrap) | Sets the wrapping mode. |
public Texture.Filter getFilter() | Returns the configured sampling filter. |
public Texture setFilter(Texture.Filter filter) | Sets the sampling filter. |
public Object getHandle() | Returns the opaque backend GPU handle. |
public void setHandle(Object handle) | Stores the opaque backend GPU handle. |
Inherited methods
Constructor details
Texture
public Texture(int width, int height)Creates a texture handle of the given dimensions. Intended for backend
use; applications create textures via
GraphicsDevice.Parameters
widthint- the texture width in pixels
heightint- the texture height in pixels
Method details
getWidth
public int getWidth()Returns the texture width in pixels.
getHeight
public int getHeight()Returns the texture height in pixels.
getWrap
public Texture.Wrap getWrap()Returns the configured wrapping mode.
setWrap
public Texture setWrap(Texture.Wrap wrap)Sets the wrapping mode. Takes effect on the next bind by the backend.
Parameters
wrapTexture.Wrap- the wrapping mode
Returns
this texture for chaining
getFilter
public Texture.Filter getFilter()Returns the configured sampling filter.
setFilter
public Texture setFilter(Texture.Filter filter)Sets the sampling filter. Takes effect on the next bind by the backend.
Parameters
filterTexture.Filter- the sampling filter
Returns
this texture for chaining
getHandle
public Object getHandle()Returns the opaque backend GPU handle. Intended for backend use.
setHandle
public void setHandle(Object handle)Stores the opaque backend GPU handle. Intended for backend use.
Parameters
handleObject- the backend specific GPU resource handle