Class ALspTextureObject

java.lang.Object
com.luciad.view.lightspeed.services.glcache.ALspGLResource
com.luciad.view.lightspeed.util.opengl.texture.ALspTextureObject
Direct Known Subclasses:
ALsp2DTextureObject

public abstract class ALspTextureObject extends ALspGLResource
Manages an OpenGL texture object. This abstract class provides the base functionality to create, bind and destroy the texture object. Definition of the texture image and other texture parameters is left up to implementing classes.
Since:
2012.0
  • Constructor Details

    • ALspTextureObject

      protected ALspTextureObject()
      Constructs a new ALspTextureObject. No OpenGL texture object is created until the first attempt to bind the texture.
    • ALspTextureObject

      protected ALspTextureObject(String aSourceString)
      Constructs a new ALspTextureObject. No OpenGL texture object is created until the first attempt to bind the texture.
  • Method Details

    • init

      protected void init(ILcdGLDrawable aGLDrawable)
      Creates a new OpenGL texture object. This method is called the first time this texture is bound. It may be extended to include initialization of the texture image (e.g. by calling glTexImage2D()).
      Parameters:
      aGLDrawable - the drawable
    • destroy

      public void destroy(ILcdGLDrawable aGLDrawable)
      Deletes the texture object owned by this ALspTextureObject.
      Overrides:
      destroy in class ALspGLResource
      Parameters:
      aGLDrawable - the drawable
    • bind

      public void bind(ILcdGLDrawable aGLDrawable)
      Binds the texture object to its appropriate target. Note that this method does not enable texture mapping on this target. This method invokes init(ILcdGLDrawable) the first time it is called.
      Overrides:
      bind in class ALspGLResource
      Parameters:
      aGLDrawable - the drawable
      See Also:
    • unbind

      public void unbind(ILcdGLDrawable aGLDrawable)
      Unbinds the texture object from its target (by binding texture object 0). Note that this method does not disable texture mapping on this target.
      Overrides:
      unbind in class ALspGLResource
      Parameters:
      aGLDrawable - the drawable
      See Also:
    • getTarget

      public abstract int getTarget()
      Returns the OpenGL enumerant for the texture target to which this texture can be bound. Allowed values include GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP...
      Returns:
      the OpenGL enumerant for the texture target to which this texture can be bound
    • getBytes

      public abstract long getBytes()
      Returns the number of estimated bytes this texture object occupies.
      Specified by:
      getBytes in class ALspGLResource
      Returns:
      the number of estimated bytes this texture object occupies
    • isDestroyed

      protected boolean isDestroyed()
      Returns true if this texture object has been destroyed. No attempts to use the texture should be made at this point.
      Returns:
      whether or not this texture has already been destroyed
      See Also:
    • getTextureObject

      public int getTextureObject()
      Returns the OpenGL texture object id. Will be -1 if the texture is not valid.
      Returns:
      the OpenGL texture object id