SenOGL
0.2
Library aiming to ease the use of OpenGL
|
#include <Program.hpp>
Public Member Functions | |
Program () | |
virtual | ~Program () |
void | init () |
Initializes the OpenGL object. More... | |
void | cleanup () |
Destroys the OpenGL object. More... | |
void | attachShader (GLuint shaderName) |
Attach a shader to this Program by its OpenGL name. More... | |
void | attachShader (const Shader &shader) |
Attach a shader to this Program. More... | |
void | attachShader (ComputeShader &cshader) |
Attach a compute shader to this Program. More... | |
void | setTransformFeedbackVaryings (GLsizei count, const char **varyings, bool intervealed) const |
Specifies values to record in transform feedback buffers. More... | |
template<size_t Count> | |
void | setTransformFeedbackVaryings (const std::array< const char *, Count > &varyings, bool intervealed) const |
Specifies values to record in transform feedback buffers. More... | |
void | link () |
Linking the program (all shaders must be compiled). More... | |
void | use () const |
Use (~bind) this Shader Program. More... | |
bool | isValid () const override |
GLint | getAttribLocation (const std::string &name) const |
void | bindAttribLocation (GLuint index, const std::string &name) const |
Associate a vertex attribute index with named attribute variable. More... | |
GLint | getUniformLocation (const std::string &name) const |
Query for the location of the specified uniform. More... | |
template<typename T > | |
void | setUniform (const std::string &name, const T &value) const |
Call the wrapper around glUniform* declared for T in UniformBinding.hpp. More... | |
GLuint | getResourceIndex (GLenum interface, const std::string &name) const |
glGetProgramResourceIndex More... | |
GLuint | getUniformBlockIndex (const std::string &name) const |
glGetuniformBlockIndex More... | |
void | bindUniformBlock (GLuint uniformBlockIndex, GLuint uniformBlockBindingPoint) const |
Assign a binding point to an active uniform block. More... | |
void | bindUniformBlock (const std::string &name, GLuint uniformBlockBindingPoint) const |
Assign a Uniform Buffer Object (UBO) to an active uniform block. More... | |
void | bindUniformBlock (const std::string &name, const UniformBuffer &uniformBuffer) const |
Assign a Uniform Buffer Object (UBO) to an active uniform block. More... | |
Public Member Functions inherited from OpenGLObject | |
OpenGLObject () | |
OpenGLObject (GLuint handle) | |
Constructs a instance managing an existing OpenGL Object. More... | |
OpenGLObject (const OpenGLObject &)=default | |
OpenGLObject (OpenGLObject &&)=default | |
OpenGLObject & | operator= (const OpenGLObject &)=default |
OpenGLObject & | operator= (OpenGLObject &&)=default |
virtual | ~OpenGLObject () |
GLuint | getName () const |
Returns OpenGL name of the object. More... | |
void | setName (GLuint n) |
Sets the OpenGL name of the object managed by this instance /!\ Use with caution ! (assignment operator is probably what you're looking for) More... | |
operator bool () const | |
Syntactic sugar for isValid(). More... | |
Static Public Member Functions | |
static void | useNone () |
Unbind any currently bound shader program. More... | |
static GLint | getCurrent () |
static GLint | getUniformLocation (GLuint programName, const std::string &uniformName) |
Additional Inherited Members | |
Protected Attributes inherited from OpenGLObject | |
GLuint | _handle |
OpenGL name of the managed object. More... | |
Program::Program | ( | ) |
|
virtual |
void Program::attachShader | ( | GLuint | shaderName | ) |
Attach a shader to this Program by its OpenGL name.
Be careful using this (especially for a ComputeShader)
shaderName | Shader's OpenGL name. |
void Program::attachShader | ( | ComputeShader & | cshader | ) |
Attach a compute shader to this Program.
(Overload of attachShader(Shader&), also links the compute shader to this particular program).
|
inline |
Associate a vertex attribute index with named attribute variable.
index | Index of the vertex attribute to be bound |
name | Name of the attribute to which index is to be bound |
void Program::bindUniformBlock | ( | GLuint | uniformBlockIndex, |
GLuint | uniformBlockBindingPoint | ||
) | const |
Assign a binding point to an active uniform block.
uniformBlockIndex | Index of a uniform block in one of the program's shaders |
uniformBlockBindingPoint | Binding point of an active Uniform Buffer Object (UBO) to assign to this uniform block |
void Program::bindUniformBlock | ( | const std::string & | name, |
GLuint | uniformBlockBindingPoint | ||
) | const |
void Program::bindUniformBlock | ( | const std::string & | name, |
const UniformBuffer & | uniformBuffer | ||
) | const |
|
virtual |
Destroys the OpenGL object.
Implements OpenGLObject.
|
inline |
name | Name of the vertex shader attribute |
|
inlinestatic |
GLuint Program::getResourceIndex | ( | GLenum | interface, |
const std::string & | name | ||
) | const |
glGetProgramResourceIndex
interface | Type of searched resource (ex: GL_SHADER_STORAGE_BLOCK) |
name | Name of the resource |
GLuint Program::getUniformBlockIndex | ( | const std::string & | name | ) | const |
glGetuniformBlockIndex
name | Name of the searched Uniform Block |
GLint Program::getUniformLocation | ( | const std::string & | name | ) | const |
Query for the location of the specified uniform.
(Simple wrapper around glGetUniformLocation)
name | Uniform's name |
|
inlinestatic |
|
virtual |
Initializes the OpenGL object.
Implements OpenGLObject.
|
inlineoverridevirtual |
Reimplemented from OpenGLObject.
void Program::link | ( | ) |
Linking the program (all shaders must be compiled).
|
inline |
Specifies values to record in transform feedback buffers.
This have to be called before linking.
count | Number of values to record. |
varyings | Array of null terminated char strings specifying the names of the varyings to record. |
intervealed | Specifies the mode of capture, if true, values will be intervealed (packed in one buffer). They will be separated otherwise (one buffer per value). |
|
inline |
Specifies values to record in transform feedback buffers.
Syntactic sugar around setTransformFeedbackVaryings(GLsizei, const char**, bool). This have to be called before linking.
varyings | Array of null terminated char strings specifying the names of the varyings to record. |
intervealed | Specifies the mode of capture, if true, values will be intervealed (packed in one buffer). They will be separated otherwise (one buffer per value). |
|
inline |
Call the wrapper around glUniform* declared for T in UniformBinding.hpp.
|
static |
Unbind any currently bound shader program.