Module gl1

Class GLSLShader

java.lang.Object
de.grogra.glsl.utility.GLSLShader
All Implemented Interfaces:
GLSLOpenGLObject
Direct Known Subclasses:
GLSLManagedShader

public abstract class GLSLShader extends Object implements GLSLOpenGLObject
Base for all complete shaders like
Author:
Konni Hartmann
  • Constructor Details

  • Method Details

    • printProgramInfoLog

      protected static void printProgramInfoLog(javax.media.opengl.GL gl, int program)
      Same as printShaderInfoLog only for Programs.
      Parameters:
      gl -
      program -
    • getShaderProgramNumber

      public int getShaderProgramNumber()
      Getter for Shader Programnumber
      Returns:
      the OpenGL id of the associated shader-program-id
    • needsRecompilation

      public boolean needsRecompilation(Object data)
      Return false if Shader depends only on Uniforms
      Parameters:
      s - Associated Shader
      Returns:
      true, if Sourcecode needs to be regenerated and recompiled
    • instanceFor

      public Class instanceFor()
      Returns:
      Class represented by this Shader
    • getInstance

      public GLSLShader getInstance()
      For "hardcompiled" Shaders this method should return a new instance
      Returns:
    • getVertexShader

      protected String[] getVertexShader(Object data)
      Parameters:
      sh -
      Returns:
    • getFragmentShader

      protected abstract String[] getFragmentShader(Object data)
      Parameters:
      sh -
      Returns:
    • setupDynamicUniforms

      protected void setupDynamicUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, Object data, int shaderNo)
      Function that loads uniforms of the represented Shader.
      Parameters:
      gl -
      disp - GLSLDisplay that tries using this shader
      data - The GroIMP-Shader-Object represented by this shader.
    • setupShader

      protected void setupShader(javax.media.opengl.GL gl, GLSLDisplay disp, Object data)
      Parameters:
      gl -
      disp -
      s -
    • activateShader

      public void activateShader(OpenGLState glState, GLSLDisplay disp, Object data)
      Only public method. Use this to activate (and compile) this Shader for use in rendering.
      Parameters:
      gl -
      disp -
      sh -
      s -
    • deleteShader

      public void deleteShader(javax.media.opengl.GL gl, boolean javaonly)
      Remove OpenGL side of this shader
      Parameters:
      gl -
    • cleanup

      public void cleanup(OpenGLState glState, boolean javaonly)
      Specified by:
      cleanup in interface GLSLOpenGLObject