Class TLsp2DImageTextureObject


public class TLsp2DImageTextureObject extends ALsp2DTextureObject
Texture object representation of a buffered image. It uses automatic mipmap generation together with linear interpolation for minification and maxification and clamps to the edges of the image. This class does not perform 'live' synchronization with the input images, i.e. the texture is not updated to reflect any changes to the image after construction.

Note that two different texture objects that are created for equal images are also equal, even though they may return a different texture object id.

Since:
2012.0
  • Constructor Details

    • TLsp2DImageTextureObject

      public TLsp2DImageTextureObject(BufferedImage aImage)
      Constructs a texture object for the given image with filtering enabled.
      Parameters:
      aImage - the image to create a texture for
      Throws:
      IllegalArgumentException - when aImage==null
    • TLsp2DImageTextureObject

      public TLsp2DImageTextureObject(BufferedImage aImage, boolean aFiltering)
      Constructs a texture object for the given image, with the option to enable or disable texture filtering.
      Parameters:
      aImage - the image to create a texture for
      aFiltering - indicates whether or not texture interpolation is desired
      Throws:
      IllegalArgumentException - when aImage==null
    • TLsp2DImageTextureObject

      public TLsp2DImageTextureObject(BufferedImage aImage, boolean aFiltering, boolean aRepeat)
      Constructs a texture object for the given image, with the options to enable or disable texture filtering and texture repeating.
      Parameters:
      aImage - the image to create a texture for
      aFiltering - whether or not filtering should be enabled
      aRepeat - whether or not the texture should be repeating
      Throws:
      IllegalArgumentException - when aImage==null
    • TLsp2DImageTextureObject

      public TLsp2DImageTextureObject(String aSourceString, BufferedImage aImage, boolean aFiltering, boolean aRepeat)
      Constructs a texture object for the given image, with the options to enable or disable texture filtering and texture repeating.
      Parameters:
      aSourceString - the name of the texture
      aImage - the image to create a texture for
      aFiltering - whether or not filtering should be enabled
      aRepeat - whether or not the texture should be repeating
      Throws:
      IllegalArgumentException - when aImage==null
  • Method Details

    • setImage

      public void setImage(BufferedImage aImage)
      Sets the given image. The given image should have the same properties as the previously set image.

      Note that this texture always has its alpha pre-multiplied, if the image has alpha but it is not pre-multiplied a conversion will be performed.

      Parameters:
      aImage - the new image to set as the texture
    • init

      protected void init(ILcdGLDrawable aGLDrawable)
      Description copied from class: ALspTextureObject
      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()).
      Overrides:
      init in class ALspTextureObject
      Parameters:
      aGLDrawable - the drawable
    • bind

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

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

      public long getBytes()
      Description copied from class: ALspTextureObject
      Returns the number of estimated bytes this texture object occupies.
      Specified by:
      getBytes in class ALspTextureObject
      Returns:
      the number of estimated bytes this texture object occupies