Class OGLProgram

java.lang.Object
com.blackrook.gloop.opengl.OGLObject
com.blackrook.gloop.opengl.gl2.OGLProgram

public class OGLProgram extends OGLObject
A linked-together shader program pipeline class.
Author:
Matthew Tropiano
  • Field Details

    • UNDELETED_IDS

      protected static int[] UNDELETED_IDS
      List of OpenGL object ids that were not deleted properly.
    • UNDELETED_LENGTH

      protected static int UNDELETED_LENGTH
      Amount of OpenGL object ids that were not deleted properly.
  • Method Details

    • free

      protected void free()
      Description copied from class: OGLObject
      Destroys this object (deallocates it on OpenAL). This is called by destroy().
      Specified by:
      free in class OGLObject
    • isLinked

      public boolean isLinked()
      Gets if this program has been linked yet. Some functions can only happen if the program has not been linked yet, for instance, vertex attrib location binding and fragment data location binding.
      Returns:
      true if so, false if not.
    • getLog

      public String getLog()
      Gets the program log after the last attempted link.
      Returns:
      the log from this program's linking, or null if not linked yet.
    • getUniformCount

      public int getUniformCount()
      Gets the number of uniforms on this program. Only available after linking.
      Returns:
      the number of uniforms on this program.
    • getUniform

      public OGLProgram.Uniform getUniform(int locationId)
      Gets a OGLProgram.Uniform by its location id. Only available after linking.
      Parameters:
      locationId - the location id.
      Returns:
      the corresponding uniform or null if not found.
    • getUniform

      public OGLProgram.Uniform getUniform(String name)
      Gets a OGLProgram.Uniform by uniform name. Only available after linking.
      Parameters:
      name - the uniform name.
      Returns:
      the corresponding uniform or null if not found.
    • getAttributeCount

      public int getAttributeCount()
      Gets the number of attributes on this program. Only available after linking.
      Returns:
      the number of attributes on this program.
    • getAttribute

      public OGLProgram.Attribute getAttribute(int locationId)
      Gets an OGLProgram.Attribute by its location id.
      Parameters:
      locationId - the location id.
      Returns:
      the corresponding attribute or null if not found.
    • getAttribute

      public OGLProgram.Attribute getAttribute(String name)
      Gets a OGLProgram.Attribute by attribute name.
      Parameters:
      name - the attribute name.
      Returns:
      the corresponding uniform or null if not found.
    • destroyUndeleted

      public static int destroyUndeleted()
      Destroys undeleted programs abandoned from destroyed Java objects.

      This is automatically called by OGLSystem after every frame and should NEVER be called manually!

      Returns:
      the amount of objects deleted.
    • finalize

      public void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable