VISH  0.2
Classes | Public Member Functions | Static Public Member Functions | Public Attributes
Wizt::GLProgram Class Reference

An OpenGL shading program. More...

#include </home/werner/origo/vish/ocean/GLvish/Shader.hpp>

List of all members.

Classes

Public Member Functions

Static Public Member Functions

Public Attributes


Detailed Description

An OpenGL shading program.

The value of a floating point slot may be directly assigned to a uniform shader variable:

   scaleFactor << Context > MyProgram;

An additional function may be applied during assignment:

   scaleFactor << Context > (MyProgram + pow10);

Constructor & Destructor Documentation

Wizt::GLProgram::GLProgram ( const string vertex_code,
const string fragment_code 
)

Construct a program with vertex and fragment shader code.

The specified vertex and fragment shader codes are compiled and linked immediatly.

The most trivial vertex shade is this:

void main(void)
{
        gl_Position = ftransform();
}

The most trivial fragment shader is this:

void main (void)
{
        gl_FragColor = gl_Color;
}

Member Function Documentation

void Wizt::GLProgram::bindFragData ( GLuint  colorNumber,
const char *  name 
) const
Note:
Calls the following OpenGL routine: http://www.opengl.org/sdk/docs/man4/xhtml/glBindFragDataLocation.xml Should be called before link(), and after program creation.
GLint Wizt::GLProgram::getAttribID ( const char *  name) const

Get the identifier of some attribute (uniform variable) as defined in the Program.

Attributes are values that are provided per vertex and declared in the Program using GSGL like in this following code fragment:

            attribute float value;
GLint Wizt::GLProgram::getAttribID ( const string name) const [inline]

Get the identifier of some attribute variable as defined in the Program.

Attributes are values that are provided per vertex and declared in the Program using GSGL like in this following code fragment:

            attribute float value;
bool Wizt::GLProgram::isValid ( ) const

Validates that this program is ready to use.

http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml

bool Wizt::GLProgram::setUniformValuef ( const char *  name,
float  value 
) const

Set a variable in the program to a certain value.

Parameters:
nameThe variable as given in the program.
Returns:
false, if the certain name is not valid in the program.
void Wizt::GLProgram::setUniformValuei ( const char *  name,
GLint  v0,
GLint  v1 
) const
std::pair< WeakPtr< GLProgram >, string > Wizt::GLProgram::uniform ( const char *  name)

Return some context on how to address a uniform variable in the shader.

Used for the >> operator.


Member Data Documentation

If this boolean is set to true, then assignments to non existent uniform variables are silently ignored.

Note that a shader program may well contain uniform variables in its source code, but they may vanish during optimized compilation. Setting this flag allows to still assign such removed variables. The default value is false.


The documentation for this class was generated from the following files: