Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

CgFragmentProgram Class Reference

#include <Cg.h>

Inheritance diagram for CgFragmentProgram:

CgProgram List of all members.

Public Member Functions

 CgFragmentProgram ()
virtual ~CgFragmentProgram ()
virtual void setup ()
 Setup, loads fragment program from harddrive.

virtual void enable ()
 Enable the fragment program.

virtual void disable ()
 Disable the fragment program.

virtual void bindTexture (const string &var, GLuint T)
 Bind a texture handle to a parameter of the fragment program.

virtual void bindTexture (const CGparameter &p, GLuint T)
 Bind a texture handle to a parameter of the fragment program.


Private Attributes

map< CGparameter, GLuint > _textures

Constructor & Destructor Documentation

CgFragmentProgram::CgFragmentProgram  ) 
 

Definition at line 272 of file Cg.cpp.

00273 {
00274 }

CgFragmentProgram::~CgFragmentProgram  )  [virtual]
 

Definition at line 276 of file Cg.cpp.

00277 {
00278 }


Member Function Documentation

void CgFragmentProgram::bindTexture const CGparameter &  p,
GLuint  T
[virtual]
 

Bind a texture handle to a parameter of the fragment program.

Definition at line 323 of file Cg.cpp.

References _textures.

00324 {
00325   _textures[p] = T;
00326   cgGLSetTextureParameter(p, T);
00327 }

void CgFragmentProgram::bindTexture const string &  var,
GLuint  T
[virtual]
 

Bind a texture handle to a parameter of the fragment program.

Definition at line 317 of file Cg.cpp.

References CgProgram::parameter().

Referenced by drawTorus().

00318 {
00319   bindTexture( parameter(var), T );
00320 }

void CgFragmentProgram::disable  )  [virtual]
 

Disable the fragment program.

Reimplemented from CgProgram.

Definition at line 304 of file Cg.cpp.

References _textures, and CgProgram::disable().

Referenced by drawTorus().

00305 {
00306   // disable textures
00307   map<CGparameter,GLuint>::const_iterator it = _textures.begin();
00308   while (it != _textures.end()) {
00309     cgGLDisableTextureParameter( (*it).first );
00310     it++;
00311   }
00312   // disable profile
00313   CgProgram::disable();
00314 }

void CgFragmentProgram::enable  )  [virtual]
 

Enable the fragment program.

Reimplemented from CgProgram.

Definition at line 291 of file Cg.cpp.

References _textures, and CgProgram::enable().

Referenced by drawTorus().

00292 {
00293   CgProgram::enable();
00294   // enable textures
00295   map<CGparameter,GLuint>::const_iterator it = _textures.begin();
00296   while (it != _textures.end()) {
00297     cgGLEnableTextureParameter( (*it).first );
00298     cgGLSetTextureParameter( (*it).first, (*it).second );
00299     it++;
00300   }
00301 }

void CgFragmentProgram::setup  )  [virtual]
 

Setup, loads fragment program from harddrive.

Also performs setup of global objects, if not already initialized

Reimplemented from CgProgram.

Definition at line 283 of file Cg.cpp.

References _textures, Cg(), CgProgram::initProfile(), and CgProgram::setup().

Referenced by initTorus().

00284 {
00285   initProfile( Cg()->fragmentProfile() );
00286   CgProgram::setup();
00287   _textures.erase( _textures.begin(), _textures.end() );
00288 }


Member Data Documentation

map<CGparameter,GLuint> CgFragmentProgram::_textures [private]
 

Definition at line 181 of file Cg.h.

Referenced by bindTexture(), disable(), enable(), and setup().


The documentation for this class was generated from the following files:
Generated on Thu Jan 20 02:47:13 2005 for Projective_Texture_Effect_Demo by doxygen 1.3.6