Package com.banuba.sdk.internal.gl
Class GLShaderProgram
- java.lang.Object
-
- com.banuba.sdk.internal.gl.GLShaderProgram
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class GLShaderProgram extends java.lang.Object implements java.io.Closeable
OpenGL shader program
-
-
Constructor Summary
Constructors Constructor Description GLShaderProgram(java.lang.String vertexShaderSource, java.lang.String fragmentShaderSource)
Create a new insance of GLShaderProgram
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close resourcesint
getAttributeLocation(java.lang.String attributeName)
Find in shader program an attribute by name and return attribute IDint
getProgramId()
Get OpenGL shader program Idint
getUniformLocation(java.lang.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
-
-
-
Method Detail
-
close
public void close()
Close resources- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.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(java.lang.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(java.lang.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)
-
-