Package playn.core
Class GLProgram
java.lang.Object
playn.core.GLProgram
- All Implemented Interfaces:
AutoCloseable
,Closeable
Encapsulates a GL vertex and fragment shader program pair.
-
Nested Class Summary
Nested classes/interfaces inherited from interface react.Closeable
Closeable.Set, Closeable.Util
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate()
Binds this shader program, in preparation for rendering.void
close()
Frees this program and associated compiled shaders.int
getAttribLocation
(String name) Returns the attribute location with the specifiedname
.int
getUniformLocation
(String name) Returns the uniform location with the specifiedname
.
-
Field Details
-
id
public final int idThe GL id of this shader program.
-
-
Constructor Details
-
GLProgram
Compiles and links the shader program described byvertexSource
andfragmentSource
.- Throws:
RuntimeException
- if the program fails to compile or link.
-
-
Method Details
-
getUniformLocation
Returns the uniform location with the specifiedname
. -
getAttribLocation
Returns the attribute location with the specifiedname
. -
activate
public void activate()Binds this shader program, in preparation for rendering. -
close
public void close()Frees this program and associated compiled shaders. The program must not be used after closure.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-