Class ShaderCache

java.lang.Object
gaiasky.util.gdx.shader.ShaderCache

public class ShaderCache extends Object
Implements shader caching to disk.
  • Field Details

    • type

      protected IntBuffer type
      Int buffer for types.
    • len

      protected IntBuffer len
      Int for shader length.
    • format

      protected IntBuffer format
      Int for shader binary format.
    • intBuffer

      protected IntBuffer intBuffer
      Aux integer buffer.
    • byteBuffer

      protected ByteBuffer byteBuffer
      Byte buffer to get binary shaders.
    • program

      protected int program
    • log

      protected String log
      Output log.
  • Constructor Details

    • ShaderCache

      public ShaderCache()
  • Method Details

    • instance

      public static ShaderCache instance()
    • isCompiled

      public boolean isCompiled()
    • getLog

      public String getLog()
    • getProgram

      public int getProgram()
    • clear

      public void clear()
    • compileShaders

      public int[] compileShaders(String name, String vertexShader, String tessControlShader, String tessEvalShader, String fragmentShader)
      Loads and compiles the shaders, creates a new program and links the shaders.
      Parameters:
      name - The name of the shader.
      vertexShader - The vertex shader code.
      tessControlShader - The tessellation control shader code.
      tessEvalShader - The tessellation evaluation shader code.
      fragmentShader - The fragment shader code.
      Returns:
      Integer array with the program handle, and the handle of every shader stage.
    • compileShaders

      public int[] compileShaders(String name, String vertexShader, String geometryShader, String fragmentShader)
      Loads and compiles the shaders, creates a new program and links the shaders.
      Parameters:
      name - The name of the shader.
      vertexShader - The vertex shader code.
      geometryShader - The geometry shader code.
      fragmentShader - The fragment shader code.
      Returns:
      Integer array with the program handle, and the handle of every shader stage.
    • compileShaders

      public int[] compileShaders(String name, String vertexShader, String fragmentShader)
      Loads and compiles the shaders, creates a new program and links the shaders.
      Parameters:
      name - The name of the shader.
      vertexShader - The vertex shader code.
      fragmentShader - The fragment shader code.
      Returns:
      Integer array with the program handle, and the handle of every shader stage.
    • createProgram

      protected int createProgram()