CL_ProgramObject - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# Class CL_ProgramObject

OpenGL Program Object More...

Derived from: none
Derived by: none
Group: GL (Display 3D)

#include <ClanLib/gl.h>

Construction:

CL_ProgramObject | Construct OpenGL program object.

Attributes:

get_handle | Returns the OpenGL program object handle.
get_link_status | Returns true if the link succeeded.
get_validate_status | Returns true if validation succeeded.
get_shaders | Returns the shaders attached to the program object.
get_info_log | Returns the current info log for the program object.
get_attribute_count | Returns the count of active attributes.
get_attributes | Returns the active attributes.
get_attribute_location | Returns the location of a named active attribute.
get_uniform_count | Returns the count of active uniform variables.
has_uniform | Returns true if the uniform variable is present in the program.
get_uniforms | Returns a list of the active uniforms.
get_uniform_location | Returns the location of a named uniform variable.

Operations:

attach | Add shader to program object.
detach | Remove shader from program object.
bind_attribute_location | Bind attribute to specific location.
link | Link program.
validate | Validate program.
use | Start using the shader.
disable | Stop using the shader.
set_uniform | Set uniform variable(s).
set_uniform_matrix | Set uniform matrices.

Detailed description:

The shader objects that are to be used by programmable stages of OpenGL are collected together to form a program object. CL_ProgramObject is ClanLib's C++ interface to OpenGL program objects.

To construct a program object programatically, the procedure is as follows:

      CL_ShaderObject vertex_shader(cl_shadertype_vertex, vertex_glsl_sourcecode);
      CL_ShaderObject fragment_shader(cl_shadertype_fragment, fragment_glsl_sourcecode);
      CL_ProgramObject program;
      program.attach(vertex_shader);
      program.attach(fragment_shader);
      program.link();

For more information about program objects, see the OpenGL 2.0 specification at www.opengl.org. Documentation about the OpenGL Shader Language (GLSL) is also available from www.opengl.org.

Questions or comments, write to the ClanLib mailing list.