NASA World Wind

gov.nasa.worldwind.render
Interface WWTexture

All Known Implementing Classes:
AbstractTacticalSymbol.IconTexture, BasicWWTexture, FBOTexture, FramebufferTexture, LazilyLoadedTexture, MacWebView.MacWebViewTexture, WebViewTexture, WindowsWebView.WindowsWebViewTexture

public interface WWTexture

Represents a texture derived from an image source such as an image file or a BufferedImage.

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
 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 height
 Object getImageSource()
          Returns the texture's image source.
 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

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:
IllegalArgumentException - if the draw context is null.

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.

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.

getImageSource

Object getImageSource()
Returns the texture's image source.

Returns:
the texture's image source.

getTexCoords

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.

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.

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:
IllegalArgumentException - if the draw context is null.

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.

NASA World Wind