GL++  0.1
OpenGL API C++ Wrapper
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
glpp::program Struct Reference

Program that can be executed in the GPU pipeline. More...

#include <program.hpp>

Inheritance diagram for glpp::program:
glpp::named_object< GLint > glpp::noncopyable

Public Types

typedef std::vector
< shared_shader_t
shaders_container_type
 Type of shaders container.
- Public Types inherited from glpp::named_object< GLint >
typedef GLint name_type
 Type of the name.

Public Member Functions

 program ()
 Construct an empty program.
 ~program ()
 Destroy and release resources of program.
void attach_shader (const shared_shader_t &psh)
 Attach a shader at program pipeline.
void detach_shader (const shared_shader_t &psh)
 Detach a shader object.
shaders_container_type get_attached_shaders () const
 Get all attached shaders.
bool is_linked () const
 Check if this program is linked.
void link () throw (link_error)
 Links a program object.
void build () throw (compile_error, link_error)
 Compile shaders and link them.
void validate ()
 Validates a program object.
bool is_valid () const
 Check if this program is valid.
const std::string info_log () const
 Returns the information log for a program object.
void use () const
 Use this program for all future rendering calls.
const shared_uniform_tget_uniform (const std::string &name) throw (uniform_not_found)
 Get an active uniform variable declared in any place (in-block or global)
const bool uniform_exists (const std::string &name)
 Check if there is uniform variable declared in any place (in-block or global)
const shared_uniform_tget_uniform (uniform::name_type uniform_index) throw (uniform_not_found)
 Get an active uniform variable declared in any place (in-block or global) by uniform index.
const shared_global_uniform_tget_global_uniform (const std::string &name) throw (uniform_not_found)
 Get an active uniform variable declared in global scope.
const shared_uniform_block_tget_uniform_block (const std::string &bname) throw (uniform_not_found)
 Get an active uniform block by name.
const shared_uniform_block_tget_uniform_block (uniform_block::name_type id) throw (uniform_not_found)
 Get an active uniform block by name.
void bind_fragcolor_to_location (GLuint location, const std::string &name)
 Bind a user-defined varying out variable to a fragment shader color number.
GLuint total_attached_shaders () const
 Get total attached shaders.
GLuint total_active_atomic_counter_buffers () const
 Get total active atomic counter buffers.
GLuint total_active_attributes () const
 Get total active attributes.
GLuint max_name_of_active_attributes () const
 Get the maximum name length of all active attributes (including null character)
GLuint total_active_uniforms () const
 Get total number of active uniforms.
GLuint max_name_of_active_uniforms () const
 Get the maximum name length of all active uniforms (including null character)
GLuint total_active_uniform_blocks () const
 Get total number of active uniform blocks.
GLuint max_name_of_active_uniform_blocks () const
 Get the maximum name length of all active uniform blocks(including null character)
GLuint binary_length () const
 Get length of programs binary format.
buffer_mode_type transform_feedback_buffer_mode () const
 Get program's feedback buffer mode.
GLuint total_transform_feedback_varyings () const
 Get total transform feedback varyings.
GLuint max_name_of_transform_feedback_varying () const
 Get the maximum name length of all transform feedback varyings (including null character)
GLuint max_geometry_vertices_out () const
 Get the maximum geometry vertices that can be produced.
primitive_type geometry_input_type () const
 Get the primitive type of geometry input.
primitive_type geometry_output_type () const
 Get the primitive type of geometry output.
- Public Member Functions inherited from glpp::named_object< GLint >
name_type object_name () const
 Return the name of object (handle)
- Public Member Functions inherited from glpp::noncopyable
 noncopyable (noncopyable &)
noncopyableoperator= (noncopyable &)

Protected Types

enum  param_type
typedef std::map
< uniform::name_type,
shared_uniform_t
uniforms_container_type
 Type of uniforms container.
typedef std::map
< uniform_block::name_type,
shared_uniform_block_t
uniform_blocks_container_type
 Type of uniform blocks container.
typedef std::map
< uniform::name_type,
shared_global_uniform_t
global_uniforms_container_type
 Type of global uniforms container.

Protected Member Functions

GLint get_param (param_type type) const
 Get a program parameter.

Protected Attributes

uniforms_container_type m_uniforms
 Uniforms container.
global_uniforms_container_type m_global_uniforms
 Global uniforms container.
uniform_blocks_container_type m_uniform_blocks
 Uniform block container.
shaders_container_type m_shaders
 Shaders container.
- Protected Attributes inherited from glpp::named_object< GLint >
GLint m_gl_name
 Stored object name.

Detailed Description

Program that can be executed in the GPU pipeline.

Remarks
non-copyable, non-inheritable, RAII

Member Enumeration Documentation

enum glpp::program::param_type
protected

: move them to types?

Constructor & Destructor Documentation

glpp::program::program ( )
glpp::program::~program ( )

Destroy and release resources of program.

http://www.opengl.org/sdk/docs/man4/xhtml/glDeleteProgram.xml

Member Function Documentation

void glpp::program::attach_shader ( const shared_shader_t psh)

Attach a shader at program pipeline.

Shared pointer is kept till the shader is detached. http://www.opengl.org/sdk/docs/man4/xhtml/glAttachShader.xml

See Also
detach_shader()
GLuint glpp::program::binary_length ( ) const

Get length of programs binary format.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

void glpp::program::bind_fragcolor_to_location ( GLuint  location,
const std::string &  name 
)

Bind a user-defined varying out variable to a fragment shader color number.

http://www.opengl.org/sdk/docs/man4/xhtml/glBindFragDataLocation.xml

void glpp::program::build ( ) throw (compile_error, link_error)

Compile shaders and link them.

This function will iterate through all shaders try to compile them, and then link them to final program. Functions that depend on exclusive use of glpp API attach_shader() detach_shader()

See Also
shader::compile() link()
void glpp::program::detach_shader ( const shared_shader_t psh)
primitive_type glpp::program::geometry_input_type ( ) const

Get the primitive type of geometry input.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

primitive_type glpp::program::geometry_output_type ( ) const

Get the primitive type of geometry output.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

shaders_container_type glpp::program::get_attached_shaders ( ) const
inline
const shared_global_uniform_t & glpp::program::get_global_uniform ( const std::string &  name) throw (uniform_not_found)

Get an active uniform variable declared in global scope.

This will return a global_uniform object that can be used to query info and set the value of global variable.

Returns
shared ptr to global_uniform
Exceptions
uniform_not_foundIf there is no uniform with this name, or if it is not a variable of global scope.
const shared_uniform_t & glpp::program::get_uniform ( const std::string &  name) throw (uniform_not_found)

Get an active uniform variable declared in any place (in-block or global)

This will return a uniform object that can be used to query info about this variable.

Returns
shared ptr to uniform
See Also
get_uniform(uniform::name_type)
const shared_uniform_t & glpp::program::get_uniform ( uniform::name_type  uniform_index) throw (uniform_not_found)

Get an active uniform variable declared in any place (in-block or global) by uniform index.

This will return a uniform object that can be used to query info about this variable.

Returns
shared ptr to uniform
See Also
get_uniform(const std::string &)
const shared_uniform_block_t & glpp::program::get_uniform_block ( const std::string &  bname) throw (uniform_not_found)

Get an active uniform block by name.

This will return a uniform_block that can be used to query info and bind it to uniform buffer objects

const shared_uniform_block_t & glpp::program::get_uniform_block ( uniform_block::name_type  id) throw (uniform_not_found)

Get an active uniform block by name.

This will return a uniform block that can be used to query info and bind it to uniform buffer objects

Returns
shared ptr to uniform_block
See Also
get_uniform_block(const std::string &)
const std::string glpp::program::info_log ( ) const

Returns the information log for a program object.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgramInfoLog.xml

bool glpp::program::is_linked ( ) const
bool glpp::program::is_valid ( ) const

Check if this program is valid.

This function will return the result of validate() http://www.opengl.org/sdk/docs/man4/xhtml/glValidateProgram.xml

void glpp::program::link ( ) throw (link_error)
GLuint glpp::program::max_geometry_vertices_out ( ) const

Get the maximum geometry vertices that can be produced.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::max_name_of_active_attributes ( ) const

Get the maximum name length of all active attributes (including null character)

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::max_name_of_active_uniform_blocks ( ) const

Get the maximum name length of all active uniform blocks(including null character)

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::max_name_of_active_uniforms ( ) const

Get the maximum name length of all active uniforms (including null character)

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::max_name_of_transform_feedback_varying ( ) const

Get the maximum name length of all transform feedback varyings (including null character)

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::total_active_atomic_counter_buffers ( ) const

Get total active atomic counter buffers.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::total_active_attributes ( ) const
GLuint glpp::program::total_active_uniform_blocks ( ) const

Get total number of active uniform blocks.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::total_active_uniforms ( ) const

Get total number of active uniforms.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

GLuint glpp::program::total_attached_shaders ( ) const
GLuint glpp::program::total_transform_feedback_varyings ( ) const

Get total transform feedback varyings.

http://www.opengl.org/sdk/docs/man4/xhtml/glGetProgram.xml

buffer_mode_type glpp::program::transform_feedback_buffer_mode ( ) const
const bool glpp::program::uniform_exists ( const std::string &  name)

Check if there is uniform variable declared in any place (in-block or global)

This will return true or false depending in the existence of object.

Returns
bool
See Also
get_uniform(std::string)
void glpp::program::use ( ) const
inline

Use this program for all future rendering calls.

http://www.opengl.org/sdk/docs/man4/xhtml/glUseProgram.xml

void glpp::program::validate ( )

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