Package com.banuba.sdk.internal.gl
Class GLShaderProgram
java.lang.Object
com.banuba.sdk.internal.gl.GLShaderProgram
- All Implemented Interfaces:
Closeable
,AutoCloseable
OpenGL shader program
-
Constructor Summary
ConstructorDescriptionGLShaderProgram
(String vertexShaderSource, String fragmentShaderSource) Create a new insance of GLShaderProgram -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close resourcesint
getAttributeLocation
(String attributeName) Find in shader program an attribute by name and return attribute IDint
Get OpenGL shader program Idint
getUniformLocation
(String uniformName) Find in shader program an uniform by name and return uniform IDvoid
setUniformMat4
(int uniform, float[] mat4, int offset) void
setUniformTexture
(int uniform, int texture) void
setUniformVec2
(int uniform, float[] vec2, int offset) void
setUniformVec2
(int uniform, float x, float y) void
setUniformVec4
(int uniform, float[] vec4, int offset) static void
unuse()
Stop using any previously used shader programvoid
use()
Use current shader program
-
Constructor Details
-
GLShaderProgram
Create a new insance of GLShaderProgram- Parameters:
vertexShaderSource
- vertex shader programfragmentShaderSource
- fragment shader program
-
-
Method Details
-
close
public void close()Close resources- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
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
Find in shader program an attribute by name and return attribute ID- Returns:
- found attrib Id or -1 in case of error
-
getUniformLocation
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)
-