Class GLShaderProgram

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

public class GLShaderProgram extends Object implements Closeable
OpenGL shader program
  • Constructor Details

    • GLShaderProgram

      public GLShaderProgram(String vertexShaderSource, String fragmentShaderSource)
      Create a new insance of GLShaderProgram
      Parameters:
      vertexShaderSource - vertex shader program
      fragmentShaderSource - fragment shader program
  • Method Details

    • close

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

      public void use()
      Use current shader program
    • unuse

      public static void unuse()
      Stop using any previously used shader program
    • getProgramId

      public int getProgramId()
      Get OpenGL shader program Id
      Returns:
      shader program id
    • getAttributeLocation

      public int getAttributeLocation(String attributeName)
      Find in shader program an attribute by name and return attribute ID
      Returns:
      found attrib Id or -1 in case of error
    • getUniformLocation

      public int getUniformLocation(String uniformName)
      Find in shader program an uniform by name and return uniform ID
      Returns:
      found uniform Id or -1 in case of error
    • setUniformTexture

      public void setUniformTexture(int uniform, int texture)
    • setUniformMat4

      public void setUniformMat4(int uniform, float[] mat4, int offset)
    • setUniformVec4

      public void setUniformVec4(int uniform, float[] vec4, int offset)
    • setUniformVec2

      public void setUniformVec2(int uniform, float x, float y)
    • setUniformVec2

      public void setUniformVec2(int uniform, float[] vec2, int offset)