OGLplus (0.45.0) a C++ wrapper for OpenGL

Program operations wrapper helper class. More...

#include </home/chochlik/devel/oglplus/include/oglplus/program.hpp>

Inheritance diagram for oglplus::ProgramOps:

Classes

class  ActiveUniformBlockInfo
 Information about a active uniform block. More...
 
class  ActiveVariableInfo
 Information about a single active vertex attribute or uniform. More...
 

Public Types

typedef Unspecified InterfaceContext
 Helper class for efficient iteration of Program interface items. More...
 
typedef Range< ProgramResourceActiveResourceRange
 The type of the range for traversing program resource information.
 
typedef Range< ActiveVariableInfoActiveAttribRange
 The type of the range for traversing active vertex attributes.
 
typedef Range< ActiveVariableInfoActiveUniformRange
 The type of the range for traversing active uniforms.
 
typedef Range< ActiveVariableInfoActiveSubroutineUniformRange
 The type of the range for traversing active subroutine uniforms.
 
typedef Range< ActiveVariableInfoTransformFeedbackVaryingRange
 The type of the range for traversing transform feedback varyings.
 
typedef Range< Managed< Shader > > ShaderRange
 The type of the range for traversing program's shaders.
 
typedef Range
< ActiveUniformBlockInfo
ActiveUniformRange
 The type of the range for traversing active uniform blocks.
 

Public Member Functions

ProgramOpsAttachShader (const ShaderOps &shader)
 Attaches the shader to this program. More...
 
ProgramOpsAttachShaders (const Group< Shader > &shaders)
 Attaches a group of shaders to this program.
 
ProgramOpsDetachShader (const ShaderOps &shader)
 Detaches the shader from this program. More...
 
bool IsLinked (void) const
 Returns true if the program is already linked, false otherwise. More...
 
String GetInfoLog (void) const
 Returns the linker output if the program is linked. More...
 
ProgramOpsLink (void)
 Links this shading language program. More...
 
bool IsValid (void) const
 Returns true if the program is validated, false otherwise. More...
 
ProgramOpsValidate (void)
 Validates this shading language program. More...
 
const ProgramOpsUse (void) const
 Uses this shading language program. More...
 
void TransformFeedbackVaryings (GLsizei count, const GLchar **varyings, TransformFeedbackMode mode)
 Sets the variables that will be captured during transform feedback. More...
 
void TransformFeedbackVarying (const GLchar *varying)
 Sets the variable that will be captured during transform feedback. More...
 
void TransformFeedbackVaryings (const std::vector< String > &varyings, TransformFeedbackMode mode) const
 Sets the variables that will be captured during transform feedback. More...
 
InterfaceContext ActiveResourceContext (ProgramInterface intf) const
 Returns the context for traversal of Program's active resources. More...
 
ActiveResourceRange ActiveResources (ProgramInterface intf) const
 Returns a range allowing to do the traversal of interface's resources. More...
 
InterfaceContext ActiveAttribContext (void) const
 Returns the context for traversal of Program's active vertex attributes. More...
 
ActiveAttribRange ActiveAttribs (void) const
 Returns a range allowing to do the traversal of active attributes. More...
 
InterfaceContext ActiveUniformContext (void) const
 Returns the context for traversal of Program's active uniforms. More...
 
ActiveUniformRange ActiveUniforms (void) const
 Returns a range allowing to do the traversal of active uniforms. More...
 
InterfaceContext ActiveSubroutineContext (ShaderType stage) const
 Returns the context for traversal of Program's active subroutines. More...
 
ActiveSubroutineRange ActiveSubroutines (ShaderType stage) const
 Returns a range allowing to do the traversal of subroutines. More...
 
InterfaceContext ActiveSubroutineUniformContext (ShaderType stage) const
 Returns the context for traversal of Program's active subr. uniforms. More...
 
ActiveSubroutineUniformRange ActiveSubroutineUniforms (ShaderType stage) const
 Returns a range allowing to do the traversal of subroutine uniforms. More...
 
InterfaceContext TransformFeedbackVaryingContext (void) const
 Returns the context for traversal of Program's active TFB varyings. More...
 
TransformFeedbackVaryingRange TransformFeedbackVaryings (void) const
 Returns a range allowing to do the traversal of feedback varyings. More...
 
ShaderRange AttachedShaders (void) const
 Returns a range allowing to traverse shaders attached to this program.
 
ActiveUniformBlockRange ActiveUniformBlocks (void) const
 Returns a range allowing to do the traversal of active attributes. More...
 
ProgramOpsMakeSeparable (bool para=true)
 Makes this program separable. More...
 
ProgramOpsMakeRetrievable (bool para=true)
 Makes this program retrievable in binary form. More...
 
void GetBinary (std::vector< GLubyte > &binary, GLenum &format) const
 Returns this programs binary representation. More...
 
void Binary (const std::vector< GLubyte > &binary, GLenum format)
 Allows to specify to program code in binary form. More...
 
TransformFeedbackMode TransformFeedbackBufferMode (void) const
 Returns the transform feedback buffer mode. More...
 
GLint GeometryVerticesOut (void) const
 Returns the number of vertices that the geometry shader will output. More...
 
GLint GeometryShaderInvocations (void) const
 Returns the number of invocations of geometry shader per primitive. More...
 
PrimitiveType GeometryInputType (void) const
 Returns the geometry shader input primitive type. More...
 
PrimitiveType GeometryOutputType (void) const
 Returns the geometry shader output primitive type. More...
 
FaceOrientation TessGenVertexOrder (void) const
 Returns the vertex order in tesselation evaluation shader. More...
 
TessGenPrimitiveType TessGenMode (void) const
 Returns the tesselation generator output primitive type. More...
 
TessGenPrimitiveSpacing TessGenSpacing (void) const
 Returns the tesselation generator primitive spacing mode. More...
 
bool TessGenPointMode (void) const
 Returns true if point mode is enabled in tesslation eval. shader. More...
 
void BindLocation (const VertexAttribOps &vertex_attrib, const GLchar *identifier) const
 Binds the location of a SL variable to the vertex_attrib. More...
 

Static Public Member Functions

static void UseNone (void)
 Deactivates the currently active/used program (if any) More...
 

Detailed Description

Program operations wrapper helper class.

This class implements OpenGL shading language program operations.

Note
Do not use this class directly, use Program instead.
See Also
Program
Related OpenGL symbols:
glCreateProgram glDeleteProgram glIsProgram

Member Typedef Documentation

Helper class for efficient iteration of Program interface items.

Instances of this class are created by a program for its specific interfaces (uniform, vertex attributes, subroutines, etc.) or stages (vertex, geometry, fragment, etc.). Instances of an interface context can be used (mostly internally) for efficient iteration of individual items of a particular interface (uniforms, subroutines, etc.). Contexts for various programs and various interfaces are not interchangeable. The InterfaceContext type should be treated as opaque and only used with appropriate functions.

Member Function Documentation

InterfaceContext oglplus::ProgramOps::ActiveAttribContext ( void  ) const

Returns the context for traversal of Program's active vertex attributes.

See Also
ActiveAttribs
ActiveAttribRange oglplus::ProgramOps::ActiveAttribs ( void  ) const

Returns a range allowing to do the traversal of active attributes.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
Error
InterfaceContext oglplus::ProgramOps::ActiveResourceContext ( ProgramInterface  intf) const

Returns the context for traversal of Program's active resources.

See Also
ActiveResources
ActiveResourceRange oglplus::ProgramOps::ActiveResources ( ProgramInterface  intf) const

Returns a range allowing to do the traversal of interface's resources.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

See Also
ProgramInterface
ProgramResource
Exceptions
Error
InterfaceContext oglplus::ProgramOps::ActiveSubroutineContext ( ShaderType  stage) const

Returns the context for traversal of Program's active subroutines.

See Also
ActiveSubroutines
ActiveSubroutineRange oglplus::ProgramOps::ActiveSubroutines ( ShaderType  stage) const

Returns a range allowing to do the traversal of subroutines.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
ErrorRequires OpenGL 4.0 or the GL_ARB_shader_subroutine extension.
InterfaceContext oglplus::ProgramOps::ActiveSubroutineUniformContext ( ShaderType  stage) const

Returns the context for traversal of Program's active subr. uniforms.

See Also
ActiveSubroutineUniforms
ActiveSubroutineUniformRange oglplus::ProgramOps::ActiveSubroutineUniforms ( ShaderType  stage) const

Returns a range allowing to do the traversal of subroutine uniforms.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
ErrorRequires OpenGL 4.0 or the GL_ARB_shader_subroutine extension.
ActiveUniformBlockRange oglplus::ProgramOps::ActiveUniformBlocks ( void  ) const

Returns a range allowing to do the traversal of active attributes.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
Error
InterfaceContext oglplus::ProgramOps::ActiveUniformContext ( void  ) const

Returns the context for traversal of Program's active uniforms.

See Also
ActiveUniforms
ActiveUniformRange oglplus::ProgramOps::ActiveUniforms ( void  ) const

Returns a range allowing to do the traversal of active uniforms.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
Error
ProgramOps& oglplus::ProgramOps::AttachShader ( const ShaderOps shader)
void oglplus::ProgramOps::Binary ( const std::vector< GLubyte > &  binary,
GLenum  format 
)

Allows to specify to program code in binary form.

See Also
MakeRetrievable
GetBinary

Requires OpenGL 4.1 or the GL_ARB_get_program_binary extension.

Related OpenGL symbols:
glProgramBinary
void oglplus::ProgramOps::BindLocation ( const VertexAttribOps vertex_attrib,
const GLchar *  identifier 
) const

Binds the location of a SL variable to the vertex_attrib.

This function binds the location of the vertex attribute vertex_attrib to the shader variable identified by identifier.

References OGLPLUS_CHECK.

ProgramOps& oglplus::ProgramOps::DetachShader ( const ShaderOps shader)

Detaches the shader from this program.

Related OpenGL symbols:
glDetachShader
PrimitiveType oglplus::ProgramOps::GeometryInputType ( void  ) const

Returns the geometry shader input primitive type.

Requires OpenGL 3.2.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_INPUT_TYPE
PrimitiveType oglplus::ProgramOps::GeometryOutputType ( void  ) const

Returns the geometry shader output primitive type.

Requires OpenGL 3.2.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_OUTPUT_TYPE
GLint oglplus::ProgramOps::GeometryShaderInvocations ( void  ) const

Returns the number of invocations of geometry shader per primitive.

Requires OpenGL 4.1 or the GL_ARB_gpu_shader5 extension.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_SHADER_INVOCATIONS
GLint oglplus::ProgramOps::GeometryVerticesOut ( void  ) const

Returns the number of vertices that the geometry shader will output.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_VERTICES_OUT
void oglplus::ProgramOps::GetBinary ( std::vector< GLubyte > &  binary,
GLenum &  format 
) const

Returns this programs binary representation.

See Also
MakeRetrievable
Binary

Requires OpenGL 4.1 or the GL_ARB_get_program_binary extension.

Related OpenGL symbols:
glGetProgram glGetProgramBinary GL_PROGRAM_BINARY_LENGTH
String oglplus::ProgramOps::GetInfoLog ( void  ) const

Returns the linker output if the program is linked.

See Also
IsLinked
Link
Related OpenGL symbols:
glGetProgram glGetProgramInfoLog
bool oglplus::ProgramOps::IsLinked ( void  ) const

Returns true if the program is already linked, false otherwise.

See Also
Link
Validate
Related OpenGL symbols:
glGetProgram GL_LINK_STATUS

Referenced by Use().

bool oglplus::ProgramOps::IsValid ( void  ) const

Returns true if the program is validated, false otherwise.

See Also
Validate
Related OpenGL symbols:
glGetProgram GL_VALIDATE_STATUS
ProgramOps& oglplus::ProgramOps::Link ( void  )
ProgramOps& oglplus::ProgramOps::MakeRetrievable ( bool  para = true)

Makes this program retrievable in binary form.

See Also
GetBinary

Requires OpenGL 4.1 or the GL_ARB_get_program_binary extension.

Related OpenGL symbols:
glProgramParameter
ProgramOps& oglplus::ProgramOps::MakeSeparable ( bool  para = true)

Makes this program separable.

Requires OpenGL 4.1 or the GL_ARB_separate_shader_objects extension.

Related OpenGL symbols:
glProgramParameter
TessGenPrimitiveType oglplus::ProgramOps::TessGenMode ( void  ) const

Returns the tesselation generator output primitive type.

Requires OpenGL 4.0 or the GL_ARB_tessellation_shader extension.

Related OpenGL symbols:
glGetProgram GL_TESS_GEN_MODE
bool oglplus::ProgramOps::TessGenPointMode ( void  ) const

Returns true if point mode is enabled in tesslation eval. shader.

Requires OpenGL 4.0 or the GL_ARB_tessellation_shader extension.

Related OpenGL symbols:
glGetProgram GL_TESS_GEN_POINT_MODE
TessGenPrimitiveSpacing oglplus::ProgramOps::TessGenSpacing ( void  ) const

Returns the tesselation generator primitive spacing mode.

Requires OpenGL 4.0 or the GL_ARB_tessellation_shader extension.

Related OpenGL symbols:
glGetProgram GL_TESS_GEN_SPACING
FaceOrientation oglplus::ProgramOps::TessGenVertexOrder ( void  ) const

Returns the vertex order in tesselation evaluation shader.

Requires OpenGL 4.0 or the GL_ARB_tessellation_shader extension.

Related OpenGL symbols:
glGetProgram GL_TESS_GEN_VERTEX_ORDER
TransformFeedbackMode oglplus::ProgramOps::TransformFeedbackBufferMode ( void  ) const

Returns the transform feedback buffer mode.

Related OpenGL symbols:
glGetProgram GL_TRANSFORM_FEEDBACK_BUFFER_MODE
void oglplus::ProgramOps::TransformFeedbackVarying ( const GLchar *  varying)

Sets the variable that will be captured during transform feedback.

Exceptions
Error
Related OpenGL symbols:
glTransformFeedbackVaryings

References oglplus::SeparateAttribs, and TransformFeedbackVaryings().

InterfaceContext oglplus::ProgramOps::TransformFeedbackVaryingContext ( void  ) const

Returns the context for traversal of Program's active TFB varyings.

See Also
TransformFeedbackVaryings
void oglplus::ProgramOps::TransformFeedbackVaryings ( GLsizei  count,
const GLchar **  varyings,
TransformFeedbackMode  mode 
)

Sets the variables that will be captured during transform feedback.

Exceptions
Error
Related OpenGL symbols:
glTransformFeedbackVaryings
void oglplus::ProgramOps::TransformFeedbackVaryings ( const std::vector< String > &  varyings,
TransformFeedbackMode  mode 
) const

Sets the variables that will be captured during transform feedback.

Exceptions
Error
Related OpenGL symbols:
glTransformFeedbackVaryings
TransformFeedbackVaryingRange oglplus::ProgramOps::TransformFeedbackVaryings ( void  ) const

Returns a range allowing to do the traversal of feedback varyings.

This instance of Program must be kept alive during the whole lifetime of the returned range, i.e. the returned range must not be used after the Program goes out of scope and is destroyed.

Exceptions
Error

Referenced by TransformFeedbackVarying().

const ProgramOps& oglplus::ProgramOps::Use ( void  ) const

Uses this shading language program.

Note
The program must be linked before it is used.
Precondition
IsLinked()
IsValid()
See Also
IsLinked
Link
Related OpenGL symbols:
glUseProgram
Examples:
standalone/001_triangle_screenshot.cpp, standalone/002_rectangle_glut_glew.cpp, standalone/020_oglplus_oalplus.cpp, and standalone/029_mandelbrot_glfw3.cpp.

References IsLinked(), and OGLPLUS_VERIFY.

static void oglplus::ProgramOps::UseNone ( void  )
static

Deactivates the currently active/used program (if any)

Related OpenGL symbols:
glUseProgram
Examples:
oglplus/029_flares.cpp, oglplus/031_sketch.cpp, oglplus/033_metal_and_glass.cpp, and oglplus/034_billiard_balls.cpp.

References OGLPLUS_VERIFY.

ProgramOps& oglplus::ProgramOps::Validate ( void  )

Validates this shading language program.

Postcondition
IsValid()
Exceptions
ErrorValidationError
See Also
Link
Related OpenGL symbols:
glValidateProgram glGetProgram glGetProgramInfoLog

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

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Wed Apr 30 2014 by Doxygen (version 1.8.4).