Graphics Reference
In-Depth Information
void SetAttribute( char *, int );
void SetAttribute( char *, float );
void SetAttribute( char *, float, float, float );
void SetAttribute( char *, float * );
void SetAttribute( char *, Vec3& );
void SetGstap( bool );
void SetInputTopology( GLenum );
void SetOutputTopology( GLenum );
void SetUniform( char *, int );
void SetUniform( char *, float );
void SetUniform( char *, float, float, float );
void SetUniform( char *, float[3] );
void SetUniform( char *, Vec3& );
void SetUniform( char *, Matrix4& );
void SetVerbose( bool );
void Use( );
void UseFixedFunction( );
The
Create( )
method takes up to five shader file names as arguments.
From the filename extension, it figures out what type of shader it is, loads it,
compiles it, and links them all together. All errors are writen to
stderr
. The
IsValid( )
method can be called if your application wants to know if every-
thing succeeded or not.
The
SetAttribute( )
methods set atribute variables, destined for the
vertex shader. The
SetUniform( )
methods set uniform variables, destined for
any of the shaders.
The
Use( )
method makes this shader program active, so that it affects
any subsequent drawing that you do.
UseFixedFunction( )
returns the state
of the pipeline to use the fixed-functionality (if it's available).
The
SetGstap( )
method is there to give you the option to have the
gstap.h
code included automatically. Just pass true as the argument. Call this
before you call the
Create( )
method.
Here is an example of using the GLSLProgram class.
#include “glslprogram.h”
float Ad, Bd, NoiseAmp, NoiseFreq, Tol;
GLSLProgram * Ovals;
. . .
// set everything up once:
Ovals = new GLSLProgram( );
Ovals->SetVerbose( true );