OpenGL::CgProgram Class Reference

#include <CgProgram.h>

List of all members.

Public Member Functions

 CgProgram (const std::string &programFile, CGprofile profile, const std::string &entryPoint, IoTextureSet *ioTextureSet)
unsigned int getParameterId (const std::string &name)
void setParameter (unsigned int parameterId, float value) const
void setParameter (unsigned int parameterId, float values[4]) const
void setMatrixParameter (unsigned int parameterId, const float values[16]) const
void setMatrixParameter (const std::string &name, const float values[16])
template<typename T>
void setParameter (const std::string &name, T value)
void setTextureParameter (const std::string &name, unsigned int value)
void setTextureParameter (unsigned int parameterId, unsigned int value)
void setFreeTextureParameter (const std::string &name, GLuint texture)
void setFreeTextureParameter (unsigned int parameterId, GLuint texture)
void loadModelViewProjection (unsigned int parameterId) const
IoTextureSetgetIoTextureSet () const
bool isInputTexture (unsigned int texture) const
void activate ()
void deactivate ()


Detailed Description

CgProgram is a simple wrapper around a Cg fragment or vertex program. It loads and initializes Cg programs, and makes it easy to activate and deactivate them by using the member functions activate() and deactivate() respectively. In addition, it contains support for setting various uniform parameters like floats, vectors, and textures. If the Cg program needs to read from textures, a reference to an IoTextureSet instance must be supplied when initializing the CgProgram instance.


Constructor & Destructor Documentation

OpenGL::CgProgram::CgProgram const std::string &  programFile,
CGprofile  profile,
const std::string &  entryPoint,
IoTextureSet ioTextureSet
 

Constructs a new CgProgram instance that acts as a wrapper for the Cg program given by the entry point in the Cg program file.

Parameters:
programFile the name of the Cg program file (including the path).
profile the Cg profile used by the Cg program.
entryPoint the entry point (function) that represents the Cg program.
ioTextureSet the texture set containing textures used by the Cg program.


Member Function Documentation

void OpenGL::CgProgram::activate  ) 
 

Activates the Cg program.

void OpenGL::CgProgram::deactivate  ) 
 

Deactivates the Cg program.

IoTextureSet * OpenGL::CgProgram::getIoTextureSet  )  const
 

Returns a pointer to the IoTextureSet instance used by the CgProgram instance.

Returns:
a pointer to the IoTextureSet instance.

unsigned int OpenGL::CgProgram::getParameterId const std::string &  name  ) 
 

Returns a parameter identifier associated with a Cg parameter with the given name. The Cg parameter is bound to the Cg program.

Parameters:
name the name of the Cg parameter.
Returns:
the parameter identifier.

bool OpenGL::CgProgram::isInputTexture unsigned int  texture  )  const
 

Returns whether the texture with the given texture identifier is set to one of the Cg parameters of this CgProgram instance.

Parameters:
texture the texture identifier.
Returns:
whether the texture is a input texture.

void OpenGL::CgProgram::loadModelViewProjection unsigned int  parameterId  )  const
 

Loads the OpenGL modelview projection matrix into the Cg parameter associated with the given parameter identifier.

Parameters:
parameterId the parameter identifier.

void OpenGL::CgProgram::setFreeTextureParameter unsigned int  parameterId,
GLuint  texture
 

Sets a free texture directly on the Cg parameter associated with the given parameter identifier. The free texture does not have to be a part of the IoTextureSet used by the CgProgram instance.

Parameters:
parameterId the parameter identifier.
texture the texture to be set on the Cg parameter.

void OpenGL::CgProgram::setFreeTextureParameter const std::string &  name,
GLuint  texture
 

Sets a free texture directly on the Cg parameter associated with the given parameter name. The free texture does not have to be a part of the IoTextureSet used by the CgProgram instance.

Parameters:
name the parameter name.
texture the texture to be set on the Cg parameter.

void OpenGL::CgProgram::setMatrixParameter const std::string &  name,
const float  values[16]
 

Sets a matrix on the Cg parameter associated with the given parameter name.

Parameters:
name the parameter name.
values the new matrix to be set on the Cg parameter.

void OpenGL::CgProgram::setMatrixParameter unsigned int  parameterId,
const float  values[16]
const
 

Sets a matrix on the Cg parameter associated with the given parameter identifier.

Parameters:
parameterId the parameter identifier.
values the new matrix to be set on the Cg parameter.

template<typename T>
void OpenGL::CgProgram::setParameter const std::string &  name,
value
 

Sets a value on the Cg parameter associated with the given parameter name.

Parameters:
name the parameter name.
value the new value to be set on the Cg parameter.

void OpenGL::CgProgram::setParameter unsigned int  parameterId,
float  values[4]
const
 

Sets a vector on the Cg parameter associated with the given parameter identifier.

Parameters:
parameterId the parameter identifier.
values the new vector to be set on the Cg parameter.

void OpenGL::CgProgram::setParameter unsigned int  parameterId,
float  value
const
 

Sets a value on the Cg parameter associated with the given parameter identifier.

Parameters:
parameterId the parameter identifier.
value the new value to be set on the Cg parameter.

void OpenGL::CgProgram::setTextureParameter unsigned int  parameterId,
unsigned int  value
 

Sets a texture on the Cg parameter associated with the given parameter identifier.

Parameters:
parameterId the parameter identifier.
value the texture identifier of the texture to be set on the Cg parameter.

void OpenGL::CgProgram::setTextureParameter const std::string &  name,
unsigned int  value
 

Sets a texture on the Cg parameter associated with the given parameter name.

Parameters:
name the parameter name.
value the texture identifier of the texture to be set on the Cg parameter.


The documentation for this class was generated from the following files:
Generated on Fri Jun 16 08:42:52 2006 for GPU Thesis by  doxygen 1.4.6-NO