Package gov.nasa.worldwind.render
Interface WWTexture
-
- All Known Implementing Classes:
AbstractTacticalSymbol.IconTexture
,BasicWWTexture
,FBOTexture
,FramebufferTexture
,LazilyLoadedTexture
public interface WWTexture
Represents a texture derived from an image source such as an image file or aBufferedImage
.The interface contains a method,
isTextureInitializationFailed()
to determine whether the instance failed to convert an image source to a texture. If such a failure occurs, the method returns true and no further attempts are made to create the texture.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyInternalTransform(DrawContext dc)
Applies any necessary transformations to the texture prior to its being rendered.boolean
bind(DrawContext dc)
Makes this texture the current texture for rendering.int
getHeight(DrawContext dc)
Returns the texture's heightjava.lang.Object
getImageSource()
Returns the texture's image source.com.jogamp.opengl.util.texture.TextureCoords
getTexCoords()
Returns the texture's texture coordinates, which may be other than [0,0],[1,1] if the texture size is not a power of two or the texture must be flipped when rendered.int
getWidth(DrawContext dc)
Returns the texture's width.boolean
isTextureCurrent(DrawContext dc)
Indicates whether the texture is currently available for use without regenerating it from its image source.boolean
isTextureInitializationFailed()
Indicates whether an attempt to initialize the texture failed, which occurs when the image source is a non-existent image file or for other reasons specific to the image source.
-
-
-
Method Detail
-
getImageSource
java.lang.Object getImageSource()
Returns the texture's image source.- Returns:
- the texture's image source.
-
bind
boolean bind(DrawContext dc)
Makes this texture the current texture for rendering.If the implementing instance's internal texture has not been created from its image source, the implementing class determines when the texture is retrieved and available.
If a texture cannot be created from its image source it cannot be bound. This method returns an indication of whether the texture was bound or was not bound due to a failure during creation.
- Parameters:
dc
- the current draw context.- Returns:
- true if the texture was bound, otherwise false.
-
applyInternalTransform
void applyInternalTransform(DrawContext dc)
Applies any necessary transformations to the texture prior to its being rendered. A common transformation is mapping texture coordinates from a flipped or non-square state to conventionally oriented OpenGL values.- Parameters:
dc
- the current draw context.- Throws:
java.lang.IllegalArgumentException
- if the draw context is null.
-
isTextureCurrent
boolean isTextureCurrent(DrawContext dc)
Indicates whether the texture is currently available for use without regenerating it from its image source.- Parameters:
dc
- the current draw context- Returns:
- true if the texture is available and consistent with its image source, otherwise false.
- Throws:
java.lang.IllegalArgumentException
- if the draw context is null.
-
getWidth
int getWidth(DrawContext dc)
Returns the texture's width.- Parameters:
dc
- the current draw context- Returns:
- the texture's width, or 0 if the texture's size is currently unknown.
-
getHeight
int getHeight(DrawContext dc)
Returns the texture's height- Parameters:
dc
- the current draw context- Returns:
- the texture's height, or 0 if the texture's size is currently unknown.
-
getTexCoords
com.jogamp.opengl.util.texture.TextureCoords getTexCoords()
Returns the texture's texture coordinates, which may be other than [0,0],[1,1] if the texture size is not a power of two or the texture must be flipped when rendered.- Returns:
- returns the texture's texture coordinates.
-
isTextureInitializationFailed
boolean isTextureInitializationFailed()
Indicates whether an attempt to initialize the texture failed, which occurs when the image source is a non-existent image file or for other reasons specific to the image source.- Returns:
- true if texture initialization failed, otherwise false.
-
-