OGLplus (0.52.0) a C++ wrapper for OpenGL

oglplus::ObjectOps< tag::DirectState, tag::Program > Class Template Reference

Class wrapping program functions (with direct state access) More...

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

Inheritance diagram for oglplus::ObjectOps< tag::DirectState, tag::Program >:
Collaboration diagram for oglplus::ObjectOps< tag::DirectState, tag::Program >:

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< ActiveVariableInfo > ActiveAttribRange
 The type of the range for traversing active vertex attributes.
 
typedef Range< ActiveVariableInfo > ActiveUniformRange
 The type of the range for traversing active uniforms.
 
typedef Range< ActiveVariableInfo > ActiveSubroutineUniformRange
 The type of the range for traversing active subroutine uniforms.
 
typedef Range< ActiveVariableInfo > TransformFeedbackVaryingRange
 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

ObjectOpsAttachShader (ShaderName shader)
 Attaches the shader to this program. More...
 
ObjectOpsAttachShaders (const Sequence< ShaderName > &shaders)
 Attaches a group of shaders to this program.
 
ObjectOpsDetachShader (ShaderName 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...
 
ObjectOpsLink (void)
 Links this shading language program. More...
 
ObjectOpsBuild (void)
 builds this shading language program More...
 
ObjectOpsBuildInclude (GLsizei count, const GLchar *const *paths, const GLint *lengths)
 builds this shading language program using specified include paths More...
 
bool IsValid (void) const
 Returns true if the program is validated, false otherwise. More...
 
ObjectOpsValidate (void)
 Validates 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...
 
ObjectOpsMakeSeparable (bool para=true)
 Makes this program separable. More...
 
ObjectOpsMakeRetrievable (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 (VertexAttribSlot vertex_attrib_slot, StrCRef identifier)
 Binds the location of a SL variable to the vertex_attrib. More...
 
void Bind (void) const
 Binds (uses) this program object. More...
 
void Use (void) const
 Uses this program object. More...
 

Static Public Member Functions

static void Bind (ProgramName program)
 Binds (uses) the specified program. More...
 
static ProgramName Binding (void)
 Returns the currently bound (active) Program. More...
 

Detailed Description

template<>
class oglplus::ObjectOps< tag::DirectState, tag::Program >

Class wrapping program functions (with direct state access)

Note
Do not use this class directly, use Program instead.

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::ObjectOps< tag::DirectState, tag::Program >::ActiveAttribContext ( void  ) const

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

See Also
ActiveAttribs
ActiveAttribRange oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::ActiveResourceContext ( ProgramInterface  intf) const

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

See Also
ActiveResources
ActiveResourceRange oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::ActiveSubroutineContext ( ShaderType  stage) const

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

See Also
ActiveSubroutines
ActiveSubroutineRange oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::ActiveSubroutineUniformContext ( ShaderType  stage) const

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

See Also
ActiveSubroutineUniforms
ActiveSubroutineUniformRange oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::ActiveUniformContext ( void  ) const

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

See Also
ActiveUniforms
ActiveUniformRange oglplus::ObjectOps< tag::DirectState, tag::Program >::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
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::AttachShader ( ShaderName  shader)

Attaches the shader to this program.

Related OpenGL symbols:
glAttachShader
void oglplus::ObjectOps< tag::DirectState, tag::Program >::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
static void oglplus::ObjBindingOps< tag::Program >::Bind ( ProgramName  program)
staticinherited

Binds (uses) the specified program.

Related OpenGL symbols:
glUseProgram

References oglplus::GetGLName().

void oglplus::ObjCommonOps< tag::Program >::Bind ( void  ) const
inherited

Binds (uses) this program object.

Note
The program must be linked before it is used.
Precondition
IsLinked()
IsValid()
Related OpenGL symbols:
glUseProgram
static ProgramName oglplus::ObjBindingOps< tag::Program >::Binding ( void  )
staticinherited

Returns the currently bound (active) Program.

Related OpenGL symbols:
glGetIntegerv
void oglplus::ObjectOps< tag::DirectState, tag::Program >::BindLocation ( VertexAttribSlot  vertex_attrib_slot,
StrCRef  identifier 
)

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::StrCRefTpl< Char >::c_str(), and oglplus::Program.

ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::Build ( void  )

builds this shading language program

This function checks if all attached shaders are compiled and if they are not the it compiles them and then links this Program.

Postcondition
IsLinked()
Exceptions
ErrorLinkError
See Also
IsLinked
Related OpenGL symbols:
glCompileShader glLinkProgram glGetProgram glGetProgramInfoLog
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::BuildInclude ( GLsizei  count,
const GLchar *const *  paths,
const GLint *  lengths 
)

builds this shading language program using specified include paths

This function checks if all attached shaders are compiled and if they are not the it compiles them and then links this Program.

Postcondition
IsLinked()
Exceptions
ErrorLinkError
See Also
IsLinked
Related OpenGL symbols:
glCompileShader glLinkProgram glGetProgram glGetProgramInfoLog
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::DetachShader ( ShaderName  shader)

Detaches the shader from this program.

Related OpenGL symbols:
glDetachShader
PrimitiveType oglplus::ObjectOps< tag::DirectState, tag::Program >::GeometryInputType ( void  ) const

Returns the geometry shader input primitive type.

Requires OpenGL 3.2.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_INPUT_TYPE
PrimitiveType oglplus::ObjectOps< tag::DirectState, tag::Program >::GeometryOutputType ( void  ) const

Returns the geometry shader output primitive type.

Requires OpenGL 3.2.

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_OUTPUT_TYPE
GLint oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::GeometryVerticesOut ( void  ) const

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

Related OpenGL symbols:
glGetProgram GL_GEOMETRY_VERTICES_OUT
void oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::GetInfoLog ( void  ) const

Returns the linker output if the program is linked.

See Also
IsLinked
Link
Related OpenGL symbols:
glGetProgram glGetProgramInfoLog
bool oglplus::ObjectOps< tag::DirectState, tag::Program >::IsLinked ( void  ) const

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

See Also
Link
Validate
Related OpenGL symbols:
glGetProgram GL_LINK_STATUS
bool oglplus::ObjectOps< tag::DirectState, tag::Program >::IsValid ( void  ) const

Returns true if the program is validated, false otherwise.

See Also
Validate
Related OpenGL symbols:
glGetProgram GL_VALIDATE_STATUS
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::Link ( void  )

Links this shading language program.

Postcondition
IsLinked()
Exceptions
ErrorLinkError
See Also
IsLinked
Related OpenGL symbols:
glLinkProgram glGetProgram glGetProgramInfoLog
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::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
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::TransformFeedbackBufferMode ( void  ) const

Returns the transform feedback buffer mode.

Related OpenGL symbols:
glGetProgram GL_TRANSFORM_FEEDBACK_BUFFER_MODE
void oglplus::ObjectOps< tag::DirectState, tag::Program >::TransformFeedbackVarying ( const GLchar *  varying)

Sets the variable that will be captured during transform feedback.

Exceptions
Error
Related OpenGL symbols:
glTransformFeedbackVaryings

References oglplus::SeparateAttribs.

InterfaceContext oglplus::ObjectOps< tag::DirectState, tag::Program >::TransformFeedbackVaryingContext ( void  ) const

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

See Also
TransformFeedbackVaryings
void oglplus::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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::ObjectOps< tag::DirectState, tag::Program >::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
void oglplus::ObjCommonOps< tag::Program >::Use ( void  ) const
inherited

Uses this program object.

Note
The program must be linked before it is used.
Precondition
IsLinked()
IsValid()
Related OpenGL symbols:
glUseProgram
ObjectOps& oglplus::ObjectOps< tag::DirectState, tag::Program >::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 file:
  • /home/chochlik/devel/oglplus/include/oglplus/program.hpp

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