openMSX
|
Wrapper around an OpenGL program: a collection of vertex and fragment shaders. More...
#include <GLUtil.hh>
Public Member Functions | |
ShaderProgram (const ShaderProgram &)=delete | |
ShaderProgram (ShaderProgram &&)=delete | |
ShaderProgram & | operator= (const ShaderProgram &)=delete |
ShaderProgram & | operator= (ShaderProgram &&)=delete |
ShaderProgram () | |
Create handler and allocate underlying openGL object. | |
ShaderProgram (Null) | |
Create null handler (don't yet allocate a openGL object). | |
~ShaderProgram () | |
Destroy handler object (release the underlying openGL object). | |
void | allocate () |
Allocate a shader program handle. | |
void | reset () |
Release the shader program handle. | |
GLuint | get () const |
Returns the underlying openGL handler id. | |
bool | isOK () const |
Returns true iff this program was linked without errors. | |
void | attach (const Shader &shader) |
Adds a given shader to this program. | |
void | link () |
Links all attached shaders together into one program. | |
void | bindAttribLocation (unsigned index, const char *name) |
Bind the given name for a vertex shader attribute to the given location. | |
GLint | getUniformLocation (const char *name) const |
Gets a reference to a uniform variable declared in the shader source. | |
void | activate () const |
Makes this program the active shader program. | |
void | validate () const |
Wrapper around an OpenGL program: a collection of vertex and fragment shaders.
|
delete |
|
delete |
|
inline |
Create handler and allocate underlying openGL object.
Definition at line 407 of file GLUtil.hh.
References allocate().
|
inlineexplicit |
|
inline |
void gl::ShaderProgram::activate | ( | ) | const |
Makes this program the active shader program.
This requires that the program is already linked.
Definition at line 283 of file GLUtil.cc.
Referenced by gl::Context::Context().
void gl::ShaderProgram::allocate | ( | ) |
Allocate a shader program handle.
Definition at line 213 of file GLUtil.cc.
Referenced by gl::Context::Context(), and ShaderProgram().
void gl::ShaderProgram::attach | ( | const Shader & | shader | ) |
Adds a given shader to this program.
Definition at line 238 of file GLUtil.cc.
References gl::Shader::isOK().
Referenced by gl::Context::Context(), and openmsx::PostProcessor::PostProcessor().
void gl::ShaderProgram::bindAttribLocation | ( | unsigned | index, |
const char * | name | ||
) |
Bind the given name for a vertex shader attribute to the given location.
Definition at line 270 of file GLUtil.cc.
Referenced by gl::Context::Context(), and openmsx::PostProcessor::PostProcessor().
|
inline |
GLint gl::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 275 of file GLUtil.cc.
References isOK().
Referenced by gl::Context::Context().
bool gl::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 230 of file GLUtil.cc.
Referenced by getUniformLocation(), and link().
void gl::ShaderProgram::link | ( | ) |
Links all attached shaders together into one program.
This should be done before activating the program.
Definition at line 250 of file GLUtil.cc.
References isOK(), openmsx::Version::RELEASE, and VLA.
Referenced by gl::Context::Context(), and openmsx::PostProcessor::PostProcessor().
|
delete |
|
delete |
void gl::ShaderProgram::reset | ( | ) |
Release the shader program handle.
Definition at line 221 of file GLUtil.cc.
Referenced by ~ShaderProgram().
void gl::ShaderProgram::validate | ( | ) | const |