Represents a texture. A texture is an image that can be used in real-time graphics libraries. All
images must be converted to instances of this class before they can be used in this framework.
public class Texture
Field Summary
Modifier and Type | Field and Description |
---|---|
protected | height Holds the height of this Texture in pixels. |
protected | textureId Holds the texture identifier associated with this Texture. |
protected | width Holds the width of this Texture in pixels. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public final void | destroy() Unloads this Texture. |
public final void | draw(RenderingContext ctx, float x, float y, float w, float h, float rot) Renders this Texture on the given OpenGL context in the given rectangular region. |
public final int | getHeight() Gets the height of the Texture. |
public final int | getTextureHandle() Gets the OpenGL ES texture identifier associated with this texture. |
public final int | getWidth() Gets the width of the Texture. |
public final boolean | isLoaded() Indicates whether the texture is loaded. |
public final void | prepare(TextureShaderProgram program, FloatBuffer textureBuffer) Prepares the OpenGL context for rendering this Texture. |
public void | waitLoad() Loads the texture in the foreground. |
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Field Detail
height |
---|
protected height Holds the height of this Texture in pixels. |
textureId |
---|
protected textureId Holds the texture identifier associated with this Texture. |
width |
---|
protected width Holds the width of this Texture in pixels. |
Method Detail
destroy |
---|
public final void destroy() Unloads this Texture. It is highly recommended that you do not call this method
directly, as it might cause problems. TextureManager takes the responsibility for
loading and unloading textures whenever required. See Also:
|
draw | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
public final void draw( RenderingContext ctx, float x, float y, float w, float h, float rot ) Renders this Texture on the given OpenGL context in the given rectangular region. It
is recommended that you do not call this method directly. Parameters:
|
getHeight |
---|
public final int getHeight() Gets the height of the Texture. This will be the processed height, so if you are
using an SVG texture, it will indicate the power-of-two estimation of the height. Returns:
The width of the texture |
getTextureHandle |
---|
public final int getTextureHandle() Gets the OpenGL ES texture identifier associated with this texture. Applications of this
method are rare and it is recommended not to use this method. Returns:
The OpenGL ES texture identifier |
getWidth |
---|
public final int getWidth() Gets the width of the Texture. This will be the processed width, so if you are using
an SVG texture, it will indicate the power-of-two estimation of the
width. Returns:
The width of the texture |
isLoaded |
---|
public final boolean isLoaded() Indicates whether the texture is loaded. The texture can be displayed only when it is loaded.
You normally don't need to check this directly and the framework takes all the required
precautions not to allow you to use unloaded textures. Returns:
true if loaded, or false otherwise |
prepare | ||||
---|---|---|---|---|
public final void prepare( TextureShaderProgram program, FloatBuffer textureBuffer ) Prepares the OpenGL context for rendering this Texture. This method must be called
before calling draw(RenderingContext, float, float, float, float, float) for correct
rendering. However, it is recommended that you do not call any of these methods directly. The
framework handles low-level rendering.Parameters:
|
waitLoad |
---|
public void waitLoad() Loads the texture in the foreground. Use this method if you need a texture to load
immediately for a specific purpose. For most applications, Artenus pipeline would
automatically handle texture loading and life cycle. |