org.proteinshader.graphics.shader
Class ShaderProgram

java.lang.Object
  extended by org.proteinshader.graphics.shader.ShaderProgram

public class ShaderProgram
extends Object

Stores information on an OpenGL Shading Language "program" object.

The vertex shader object, fragment shader object, and the "program" object they are linked with are all stored on the graphics card. OpenGL assigns an integer reference (a C language type handle) that is needed by OpenGL commands that work with these objects. This Java class stores these integer references, as well as the Java File objects that refer to the shader source code files.

This class is only for storing information. The ShaderProgramFactory has the methods used to compile and link shaders, as well as a method to delete them from graphics card memory.


Constructor Summary
ShaderProgram()
          Constructs a ShaderProgram object to store info on an OpenGL Shading Language "program" object.
ShaderProgram(File vertFile, File fragFile, ShaderEnum pair)
          Constructs a ShaderProgram object to store info on an OpenGL Shading Language "program" object.
 
Method Summary
 File getFragFile()
          Returns the File the fragment shader source code was obtained from.
 int getFragShaderName()
          Returns the name (an integer) of the fragment shader object.
 ShaderEnum getPair()
          Returns the type of shader pair (vertex and fragment pair).
 int getProgramName()
          Returns the name (an integer) of the OpenGL Shading Language "program" object.
 File getVertFile()
          Returns the File the vertex shader source code was obtained from.
 int getVertShaderName()
          Returns the name (an integer) of the vertex shader object.
 void setFragFile(File fragFile)
          Sets the fragment shader source code File.
 void setFragShaderName(int fragShaderName)
          Sets the name (an integer) of the OpenGL fragment shader object.
 void setPair(ShaderEnum pair)
          Sets the type of shader pair (vertex and fragment pair).
 void setProgramName(int programName)
          Sets the name (an integer) of the OpenGL Shading Language "program" object.
 void setVertFile(File vertFile)
          Sets the vertex shader source code File.
 void setVertShaderName(int vertShaderName)
          Sets the name (an integer) of the OpenGL vertex shader object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShaderProgram

public ShaderProgram(File vertFile,
                     File fragFile,
                     ShaderEnum pair)
Constructs a ShaderProgram object to store info on an OpenGL Shading Language "program" object.

Parameters:
vertFile - the file with the vertex shader source code.
fragFile - the file with the fragment shader source code.
pair - the ShaderEnum that the vertex and fragment shader filenames were originally stored in.

ShaderProgram

public ShaderProgram()
Constructs a ShaderProgram object to store info on an OpenGL Shading Language "program" object.

Method Detail

getPair

public ShaderEnum getPair()
Returns the type of shader pair (vertex and fragment pair).

Returns:
The pair as a ShaderEnum.

setPair

public void setPair(ShaderEnum pair)
Sets the type of shader pair (vertex and fragment pair).

Parameters:
pair - the type of shader pair.

getProgramName

public int getProgramName()
Returns the name (an integer) of the OpenGL Shading Language "program" object.

Returns:
The name (an integer) of the OpenGL "program" object.

setProgramName

public void setProgramName(int programName)
Sets the name (an integer) of the OpenGL Shading Language "program" object.

Parameters:
programName - the name (an integer) of the OpenGL "program" object.

getVertShaderName

public int getVertShaderName()
Returns the name (an integer) of the vertex shader object.

Returns:
The name (an integer) of the vertex shader.

setVertShaderName

public void setVertShaderName(int vertShaderName)
Sets the name (an integer) of the OpenGL vertex shader object.

Parameters:
vertShaderName - the name (an integer) of the vertex shader.

getFragShaderName

public int getFragShaderName()
Returns the name (an integer) of the fragment shader object.

Returns:
The name (an integer) of the fragment shader.

setFragShaderName

public void setFragShaderName(int fragShaderName)
Sets the name (an integer) of the OpenGL fragment shader object.

Parameters:
fragShaderName - the name (an integer) of the fragment shader.

getVertFile

public File getVertFile()
Returns the File the vertex shader source code was obtained from.

Returns:
The vertex shader File.

setVertFile

public void setVertFile(File vertFile)
Sets the vertex shader source code File.

Parameters:
vertFile - the vertex shader File.

getFragFile

public File getFragFile()
Returns the File the fragment shader source code was obtained from.

Returns:
The fragment shader File.

setFragFile

public void setFragFile(File fragFile)
Sets the fragment shader source code File.

Parameters:
fragFile - the fragment shader File.


Copyright © 2007-2008