openMSX
Public Member Functions | Static Public Member Functions | List of all members
openmsx::ShaderProgram Class Reference

Wrapper around an OpenGL program: a collection of vertex and fragment shaders. More...

#include <GLUtil.hh>

Inheritance diagram for openmsx::ShaderProgram:
Inheritance graph
[legend]
Collaboration diagram for openmsx::ShaderProgram:
Collaboration graph
[legend]

Public Member Functions

 ShaderProgram ()
 
 ~ShaderProgram ()
 
bool isOK () const
 Returns true iff this program was linked without errors. More...
 
void attach (const Shader &shader)
 Adds a given shader to this program. More...
 
void link ()
 Links all attached shaders together into one program. More...
 
GLint getUniformLocation (const char *name) const
 Gets a reference to a uniform variable declared in the shader source. More...
 
void activate () const
 Makes this program the active shader program. More...
 
void validate ()
 

Static Public Member Functions

static void deactivate ()
 Deactivates all shader programs. More...
 

Additional Inherited Members

- Protected Member Functions inherited from noncopyable
 noncopyable ()
 
 ~noncopyable ()
 

Detailed Description

Wrapper around an OpenGL program: a collection of vertex and fragment shaders.

Definition at line 439 of file GLUtil.hh.

Constructor & Destructor Documentation

openmsx::ShaderProgram::ShaderProgram ( )

Definition at line 311 of file GLUtil.cc.

openmsx::ShaderProgram::~ShaderProgram ( )

Definition at line 321 of file GLUtil.cc.

Member Function Documentation

void openmsx::ShaderProgram::activate ( ) const
void openmsx::ShaderProgram::attach ( const Shader shader)
void openmsx::ShaderProgram::deactivate ( )
static

Deactivates all shader programs.

Definition at line 388 of file GLUtil.cc.

Referenced by openmsx::GLPostProcessor::paint(), and openmsx::GLScaler::scaleImage().

GLint openmsx::ShaderProgram::getUniformLocation ( const char *  name) const

Gets a reference to a uniform variable declared in the shader source.

Note that you have to activate this program before you can change the uniform variable's value.

Definition at line 366 of file GLUtil.cc.

References isOK().

Referenced by openmsx::GLSaIScaler::GLSaIScaler(), openmsx::GLScaleNxScaler::GLScaleNxScaler(), openmsx::GLScaler::GLScaler(), and openmsx::GLTVScaler::GLTVScaler().

bool openmsx::ShaderProgram::isOK ( ) const

Returns true iff this program was linked without errors.

Note that this will certainly return false until link() is called.

Definition at line 326 of file GLUtil.cc.

Referenced by getUniformLocation(), and link().

void openmsx::ShaderProgram::link ( )

Links all attached shaders together into one program.

This should be done before activating the program.

Definition at line 346 of file GLUtil.cc.

References isOK(), openmsx::Version::RELEASE, and VLA.

Referenced by openmsx::GLHQLiteScaler::GLHQLiteScaler(), openmsx::GLHQScaler::GLHQScaler(), openmsx::GLSaIScaler::GLSaIScaler(), openmsx::GLScaleNxScaler::GLScaleNxScaler(), openmsx::GLScaler::GLScaler(), and openmsx::GLTVScaler::GLTVScaler().

void openmsx::ShaderProgram::validate ( )

Definition at line 394 of file GLUtil.cc.

References VLA.


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