Class GLShaderProgram
- java.lang.Object
-
- org.viduus.lwjgl.graphics.shaders.core.ShaderProgram
-
- org.viduus.lwjgl.graphics.shaders.opengl.GLShaderProgram
-
public class GLShaderProgram extends ShaderProgram
-
-
Constructor Summary
Constructors Constructor Description GLShaderProgram(java.lang.String shader_name, ShaderManager manager, ShaderVariableInterface var_interface)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind()
Binds the shader to the GPUvoid
bindAttributes(int byte_offset, ShaderVariable... attributes)
Binds the specified attributes to the GPUprotected void
createProgram()
Creates a new shader program in the GPUvoid
delete()
Deletes this shader from the GPU.void
errorCheck(java.lang.String info)
Does api specific error checkingprotected void
link()
Links all of the shader sources togetherprotected void
loadShaderVariables(SymbolTable variables)
This function is responsible for loading all shader variables and adding them to the passed symbol table.protected ShaderSource
loadSource(java.lang.String shader_name, ShaderType type)
Loads and creates a new shader source.void
unbind()
Unbinds the shader from the GPUvoid
unbindAttributes(ShaderVariable... attributes)
Unbinds already bound attributes from the GPU.protected void
validate()
Validates that the shader program linked correctly-
Methods inherited from class org.viduus.lwjgl.graphics.shaders.core.ShaderProgram
attribute, attributeExists, attributes, bindAttributes, dataLayout, id, id, name, source, uniform, uniformExists, uniforms
-
-
-
-
Constructor Detail
-
GLShaderProgram
public GLShaderProgram(java.lang.String shader_name, ShaderManager manager, ShaderVariableInterface var_interface) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
loadSource
protected ShaderSource loadSource(java.lang.String shader_name, ShaderType type) throws java.io.IOException
Description copied from class:ShaderProgram
Loads and creates a new shader source.- Specified by:
loadSource
in classShaderProgram
- Parameters:
shader_name
- The name of the shader to loadtype
- The type of shader to load- Returns:
- The new shader
- Throws:
java.io.IOException
- If shader file could not be read
-
createProgram
protected void createProgram()
Description copied from class:ShaderProgram
Creates a new shader program in the GPU- Specified by:
createProgram
in classShaderProgram
-
link
protected void link()
Description copied from class:ShaderProgram
Links all of the shader sources together- Specified by:
link
in classShaderProgram
-
validate
protected void validate()
Description copied from class:ShaderProgram
Validates that the shader program linked correctly- Specified by:
validate
in classShaderProgram
-
unbind
public void unbind()
Description copied from class:ShaderProgram
Unbinds the shader from the GPU- Specified by:
unbind
in classShaderProgram
-
bind
public void bind()
Description copied from class:ShaderProgram
Binds the shader to the GPU- Specified by:
bind
in classShaderProgram
-
delete
public void delete()
Description copied from class:ShaderProgram
Deletes this shader from the GPU. It will no longer be usable after this point.- Specified by:
delete
in classShaderProgram
-
errorCheck
public void errorCheck(java.lang.String info)
Description copied from class:ShaderProgram
Does api specific error checking- Specified by:
errorCheck
in classShaderProgram
- Parameters:
info
- A message that should be reported with the error
-
bindAttributes
public void bindAttributes(int byte_offset, ShaderVariable... attributes)
Description copied from class:ShaderProgram
Binds the specified attributes to the GPU- Specified by:
bindAttributes
in classShaderProgram
- Parameters:
byte_offset
- The offset between subsequent data packets in the vboattributes
- The attributes, in order, that occur in each data packet
-
unbindAttributes
public void unbindAttributes(ShaderVariable... attributes)
Description copied from class:ShaderProgram
Unbinds already bound attributes from the GPU.- Specified by:
unbindAttributes
in classShaderProgram
- Parameters:
attributes
- The attributes to unbind from the GPU
-
loadShaderVariables
protected void loadShaderVariables(SymbolTable variables)
Description copied from class:ShaderProgram
This function is responsible for loading all shader variables and adding them to the passed symbol table. Any variables not added to this symbol table will not be accessible through the getter functions.- Specified by:
loadShaderVariables
in classShaderProgram
- Parameters:
variables
- The symbol table to build
-
-