#include <Cg.h>
Inheritance diagram for CgFragmentProgram:

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 |
|
|
Definition at line 272 of file Cg.cpp.
00273 {
00274 }
|
|
|
Definition at line 276 of file Cg.cpp.
00277 {
00278 }
|
|
||||||||||||
|
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 }
|
|
||||||||||||
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
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 }
|
|
|
Definition at line 181 of file Cg.h. Referenced by bindTexture(), disable(), enable(), and setup(). |
1.3.6