Class GLTexture

java.lang.Object
com.banuba.sdk.internal.gl.GLTexture
All Implemented Interfaces:
Closeable, AutoCloseable

public class GLTexture extends Object implements Closeable
OpenGL texture
  • Constructor Summary

    Constructors
    Constructor
    Description
    GLTexture(int colorComponents)
    Create a new insance of GLTexture
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    associateWithUniformAndTextureUnit(int uniformLocation, int textureUnitNumber)
    Associate this texture with uniform variable in the shader program, and set texture unit
    void
    Bind this texture and setup texture sampler in the sahder.
    void
    Close resources
    int
    Get OpenGL texture ID
    void
    setTextureData(ByteBuffer data, int width, int height, int strideInPixels)
    Set texture data
    static void
    Unbind any previously bound shader program

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GLTexture

      public GLTexture(int colorComponents)
      Create a new insance of GLTexture
      Parameters:
      colorComponents - number of the color components: 1 - for GL_LUMINANCE texture 2 - for GL_RG texture 3 - for GL_RGB texture 4 - for GL_RGBA texture
  • Method Details

    • associateWithUniformAndTextureUnit

      public void associateWithUniformAndTextureUnit(int uniformLocation, int textureUnitNumber)
      Associate this texture with uniform variable in the shader program, and set texture unit
      Parameters:
      uniformLocation - uniform id
      textureUnitNumber -
      See Also:
    • bind

      public void bind()
      Bind this texture and setup texture sampler in the sahder. (The method must have been called before associateWithUniformAndTextureUnit)
    • unbind

      public static void unbind()
      Unbind any previously bound shader program
    • setTextureData

      public void setTextureData(ByteBuffer data, int width, int height, int strideInPixels)
      Set texture data
      Parameters:
      data - image data
      width - width of the image
      height - height of the image
      strideInPixels - image stride in number of pixels
    • getTextureId

      public int getTextureId()
      Get OpenGL texture ID
      Returns:
      texture Id
    • close

      public void close()
      Close resources
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable