List of all members
clan::ProgramObject Class Reference
clanDisplay Display

Program Object. More...

`#include <program_object.h>`

## Public Member Functions
Attributes
bool | is_null () const
| Returns true if this object is invalid. More...
void | throw_if_null () const
| Throw an exception if this object is invalid. More...
ProgramObjectProvider * | get_provider () const
| Retrieves the provider. More...
unsigned int | get_handle () const
| Returns the OpenGL program object handle. More...
std::vector< ShaderObject > | get_shaders () const
| Returns the shaders attached to the program object. More...
std::string | get_info_log () const
| Returns the current info log for the program object. More...
int | get_attribute_location (const std::string &name) const
| Returns the location of a named active attribute. More...
int | get_uniform_location (const std::string &name) const
| Returns the location of a named uniform variable. More...
int | get_uniform_buffer_size (const std::string &block_name) const
| Get the uniform block size. More...
int | get_uniform_buffer_size (int block_index) const
| Get the uniform block size. More...
int | get_uniform_buffer_index (const std::string &block_name) const
| Get the uniform block index. More...
int | get_storage_buffer_index (const std::string &name) const
| Get the storage buffer index. More...
Operations
bool | operator== (const ProgramObject &other) const
| Equality operator. More...
void | attach (const ShaderObject &obj)
| Add shader to program object. More...
void | detach (const ShaderObject &obj)
| Remove shader from program object. More...
void | bind_attribute_location (int index, const std::string &name)
| Bind attribute to specific location. More...
void | bind_frag_data_location (int color_number, const std::string &name)
| Bind shader out variable a specific color buffer location. More...
bool | link ()
| Link program. More...
bool | validate ()
| Validate program. More...
void | set_uniform1i (int location, int value_a)
void | set_uniform2i (int location, int value_a, int value_b)
void | set_uniform3i (int location, int value_a, int value_b, int value_c)
void | set_uniform4i (int location, int value_a, int value_b, int value_c, int value_d)
void | set_uniformiv (int location, int size, int count, const int *data)
void | set_uniform2i (int location, const Vec2i &vec)
void | set_uniform3i (int location, const Vec3i &vec)
void | set_uniform4i (int location, const Vec4i &vec)
void | set_uniform2s (int location, const Vec2s &vec)
void | set_uniform3s (int location, const Vec3s &vec)
void | set_uniform4s (int location, const Vec4s &vec)
void | set_uniform2b (int location, const Vec2b &vec)
void | set_uniform3b (int location, const Vec3b &vec)
void | set_uniform4b (int location, const Vec4b &vec)
void | set_uniformiv (int location, int count, const Vec2i *data)
void | set_uniformiv (int location, int count, const Vec3i *data)
void | set_uniformiv (int location, int count, const Vec4i *data)
void | set_uniform1f (int location, float value_a)
void | set_uniform2f (int location, float value_a, float value_b)
void | set_uniform3f (int location, float value_a, float value_b, float value_c)
void | set_uniform4f (int location, float value_a, float value_b, float value_c, float value_d)
void | set_uniformfv (int location, int size, int count, const float *data)
void | set_uniform2f (int location, const Vec2f &vec)
void | set_uniform3f (int location, const Vec3f &vec)
void | set_uniform4f (int location, const Vec4f &vec)
void | set_uniformfv (int location, int count, const Vec2f *data)
void | set_uniformfv (int location, int count, const Vec3f *data)
void | set_uniformfv (int location, int count, const Vec4f *data)
void | set_uniform_matrix (int location, int size, int count, bool transpose, const float *data)
void | set_uniform_matrix (int location, const Mat2f &matrix)
void | set_uniform_matrix (int location, const Mat3f &matrix)
void | set_uniform_matrix (int location, const Mat4f &matrix)
void | set_uniform_matrix (int location, int count, const Mat2f *matrix)
void | set_uniform_matrix (int location, int count, const Mat3f *matrix)
void | set_uniform_matrix (int location, int count, const Mat4f *matrix)
void | set_uniform1i (const std::string &name, int value_a)
void | set_uniform2i (const std::string &name, int value_a, int value_b)
void | set_uniform3i (const std::string &name, int value_a, int value_b, int value_c)
void | set_uniform4i (const std::string &name, int value_a, int value_b, int value_c, int value_d)
void | set_uniformiv (const std::string &name, int size, int count, const int *data)
void | set_uniform2i (const std::string &name, const Vec2i &vec)
void | set_uniform3i (const std::string &name, const Vec3i &vec)
void | set_uniform4i (const std::string &name, const Vec4i &vec)
void | set_uniform2s (const std::string &name, const Vec2s &vec)
void | set_uniform3s (const std::string &name, const Vec3s &vec)
void | set_uniform4s (const std::string &name, const Vec4s &vec)
void | set_uniform2b (const std::string &name, const Vec2b &vec)
void | set_uniform3b (const std::string &name, const Vec3b &vec)
void | set_uniform4b (const std::string &name, const Vec4b &vec)
void | set_uniformiv (const std::string &name, int count, const Vec2i *data)
void | set_uniformiv (const std::string &name, int count, const Vec3i *data)
void | set_uniformiv (const std::string &name, int count, const Vec4i *data)
void | set_uniform1f (const std::string &name, float value_a)
void | set_uniform2f (const std::string &name, float value_a, float value_b)
void | set_uniform3f (const std::string &name, float value_a, float value_b, float value_c)
void | set_uniform4f (const std::string &name, float value_a, float value_b, float value_c, float value_d)
void | set_uniformfv (const std::string &name, int size, int count, const float *data)
void | set_uniform2f (const std::string &name, const Vec2f &vec)
void | set_uniform3f (const std::string &name, const Vec3f &vec)
void | set_uniform4f (const std::string &name, const Vec4f &vec)
void | set_uniformfv (const std::string &name, int count, const Vec2f *data)
void | set_uniformfv (const std::string &name, int count, const Vec3f *data)
void | set_uniformfv (const std::string &name, int count, const Vec4f *data)
void | set_uniform_matrix (const std::string &name, int size, int count, bool transpose, const float *data)
void | set_uniform_matrix (const std::string &name, const Mat2f &matrix)
void | set_uniform_matrix (const std::string &name, const Mat3f &matrix)
void | set_uniform_matrix (const std::string &name, const Mat4f &matrix)
void | set_uniform_matrix (const std::string &name, int count, const Mat2f *matrix)
void | set_uniform_matrix (const std::string &name, int count, const Mat3f *matrix)
void | set_uniform_matrix (const std::string &name, int count, const Mat4f *matrix)
void | set_uniform_buffer_index (const std::string &block_name, int bind_index)
| Sets the UniformBuffer. More...
void | set_uniform_buffer_index (int block_index, int bind_index)
| Sets the UniformBuffer. More...
void | set_storage_buffer_index (const std::string &block_name, int bind_index)
| Sets the UniformBuffer. More...
void | set_storage_buffer_index (int block_index, int bind_index)
| Sets the UniformBuffer. More...

## Construction
| ProgramObject ()
| Construct a null instance. More...
| ProgramObject (GraphicContext &gc)
| Constructs a ProgramObject. More...
| ProgramObject (GraphicContextProvider *gc_provider)
| Constructs a ProgramObject. More...
| ProgramObject (ProgramObjectProvider *provider)
| Constructs a ProgramObject. More...
virtual | ~ProgramObject ()
static ProgramObject | load (GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resman)
| Load. More...
static ProgramObject | load (GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname)
| Load. More...
static ProgramObject | load (GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname)
| Load. More...
static ProgramObject | load (GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs)
| Load. More...
static ProgramObject | load (GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs)
| Load. More...
static ProgramObject | load (GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file)
| Load. More...
static ProgramObject | load (GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file)
| Load. More...
static ProgramObject | load_and_link (GraphicContext &gc, const std::string &vertex_fullname, const std::string &fragment_fullname)
| Load and link. More...
static ProgramObject | load_and_link (GraphicContext &gc, const std::string &vertex_fullname, const std::string &geometry_fullname, const std::string &fragment_fullname)
| Load and link. More...
static ProgramObject | load_and_link (GraphicContext &gc, const std::string &vertex_filename, const std::string &fragment_filename, const FileSystem &fs)
| Load and link. More...
static ProgramObject | load_and_link (GraphicContext &gc, const std::string &vertex_filename, const std::string &geometry_filename, const std::string &fragment_filename, const FileSystem &fs)
| Load and link. More...
static ProgramObject | load_and_link (GraphicContext &gc, IODevice &vertex_file, IODevice &fragment_file)
| Load and link. More...
static ProgramObject | load_and_link (GraphicContext &gc, IODevice &vertex_file, IODevice &geometry_file, IODevice &fragment_file)
| Load and link. More...

## Detailed Description

Program Object.

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

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

       ShaderObject vertex_shader(shadertype_vertex, vertex_glsl_sourcecode);
       ShaderObject fragment_shader(shadertype_fragment, fragment_glsl_sourcecode);
       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.

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

- program_object.h