Class TLspSimpleShaderProgram
- Since:
- 2012.0
-
Constructor Summary
ConstructorDescriptionTLspSimpleShaderProgram
(String aVertexShaderPath, String aFragmentShaderPath) Constructs a shader program with the given vertex and fragment shader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(ILcdGLDrawable aGLDrawable) Binds this GL resource for use with the givenILcdGLDrawable
.void
destroy
(ILcdGLDrawable aGLDrawable) Destroy the shader program and all shaders attached to it.void
unbind
(ILcdGLDrawable aGLDrawable) Unbinds this GL resource from the givenILcdGLDrawable
.Methods inherited from class com.luciad.view.lightspeed.util.opengl.glsl.TLspShaderProgram
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
Methods inherited from class com.luciad.view.lightspeed.services.glcache.ALspGLResource
getSourceString, isBound, toString
-
Constructor Details
-
TLspSimpleShaderProgram
Constructs a shader program with the given vertex and fragment shader. One of both parameters may be null to construct a shader program with only a vertex shader or only a fragment shader. The shader will be lazily constructed during the first call of thebind()
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 callinguse
.- Parameters:
aVertexShaderPath
- the full path to the vertex shaderaFragmentShaderPath
- the full path to the fragment shader- Throws:
IllegalArgumentException
- when both shader paths are null
-
-
Method Details
-
bind
Description copied from class: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 invokesuper.bind()
, as this is required for the correct behavior ofALspGLResource.isBound()
.If this resource was already destroyed and the
destroy
implementation callssuper.destroy
, a runtime exception will be thrown when calling this method.- Overrides:
bind
in classTLspShaderProgram
- Parameters:
aGLDrawable
- the GL drawable in which this resource is to be bound
-
unbind
Description copied from class: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 ofALspGLResource.bind(com.luciad.view.opengl.binding.ILcdGLDrawable)
. Inheriting classes must also always invokesuper.unbind()
, as this is required for the correct behavior ofALspGLResource.isBound()
.If this resource was already destroyed and the
destroy
implementation callssuper.destroy
, a runtime exception will be thrown when calling this method.- Overrides:
unbind
in classTLspShaderProgram
- Parameters:
aGLDrawable
- the drawable from which the GL resource should be unbound
-
destroy
Destroy the shader program and all shaders attached to it.- Overrides:
destroy
in classTLspShaderProgram
- Parameters:
aGLDrawable
- the drawable this resource is used for
-