public class TLspSimpleShaderProgram extends TLspShaderProgram
Constructor and Description |
---|
TLspSimpleShaderProgram(String aVertexShaderPath,
String aFragmentShaderPath)
Constructs a shader program with the given vertex and fragment shader.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(ILcdGLDrawable aGLDrawable)
Binds this GL resource for use with the given
ILcdGLDrawable . |
void |
destroy(ILcdGLDrawable aGLDrawable)
Destroy the shader program and
all shaders attached to it.
|
void |
unbind(ILcdGLDrawable aGLDrawable)
Unbinds this GL resource from the given
ILcdGLDrawable . |
add, attachShaders, disableVertexAttribArray, getAttribLocation, getBytes, getID, getShaders, getUniformLocation, link, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformData, setUniformMatrixData, setUniformMatrixData, setVertexAttribArray, setVertexAttribData, setVertexAttribData, setVertexAttribData, setVertexAttribData, setVertexAttribData, setVertexAttribData
getSourceString, isBound, toString
public TLspSimpleShaderProgram(String aVertexShaderPath, String aFragmentShaderPath)
bind()
method. If illegal parameters are
provided (for example, the shader could not be linked or the source files
could not be found), a runtime exception
will be thrown when calling use
.aVertexShaderPath
- the full path to the vertex shaderaFragmentShaderPath
- the full path to the fragment shaderIllegalArgumentException
- when both shader paths are nullpublic void bind(ILcdGLDrawable aGLDrawable)
ALspGLResource
Binds this GL resource for use with the given ILcdGLDrawable
.
Implementations should override this method to perform the appropriate
OpenGL call, e.g. glBindTexture()
. Inheriting classes must also
always invoke super.bind()
, as this is required for the correct
behavior of ALspGLResource.isBound()
.
If this resource was already destroyed and the destroy
implementation calls
super.destroy
, a runtime exception will be thrown when calling this method.
bind
in class TLspShaderProgram
aGLDrawable
- the GL drawable in which this resource is to be boundpublic void unbind(ILcdGLDrawable aGLDrawable)
ALspGLResource
Unbinds this GL resource from the given ILcdGLDrawable
.
Implementations should override this method to perform whatever OpenGL
calls are needed to undo the effects of
ALspGLResource.bind(com.luciad.view.opengl.binding.ILcdGLDrawable)
.
Inheriting classes must also always invoke super.unbind()
, as this
is required for the correct behavior of ALspGLResource.isBound()
.
If this resource was already destroyed and the destroy
implementation calls
super.destroy
, a runtime exception will be thrown when calling this method.
unbind
in class TLspShaderProgram
aGLDrawable
- the drawable from which the GL resource should be unboundpublic void destroy(ILcdGLDrawable aGLDrawable)
destroy
in class TLspShaderProgram
aGLDrawable
- the drawable this resource is used for