Class TLspSimpleShaderProgram


public class TLspSimpleShaderProgram extends TLspShaderProgram
Simple GLSL shader program that can have 0 or 1 vertex shaders and 0 or 1 fragment shaders.
Since:
2012.0
  • Constructor Details

    • TLspSimpleShaderProgram

      public TLspSimpleShaderProgram(String aVertexShaderPath, String aFragmentShaderPath)
      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 the 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.

      Parameters:
      aVertexShaderPath - the full path to the vertex shader
      aFragmentShaderPath - the full path to the fragment shader
      Throws:
      IllegalArgumentException - when both shader paths are null
  • Method Details

    • bind

      public void bind(ILcdGLDrawable aGLDrawable)
      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 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.

      Overrides:
      bind in class TLspShaderProgram
      Parameters:
      aGLDrawable - the GL drawable in which this resource is to be bound
    • unbind

      public void unbind(ILcdGLDrawable aGLDrawable)
      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 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.

      Overrides:
      unbind in class TLspShaderProgram
      Parameters:
      aGLDrawable - the drawable from which the GL resource should be unbound
    • destroy

      public void destroy(ILcdGLDrawable aGLDrawable)
      Destroy the shader program and all shaders attached to it.
      Overrides:
      destroy in class TLspShaderProgram
      Parameters:
      aGLDrawable - the drawable this resource is used for