Carna  Version 3.3.2
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Carna::base::Shader Class Reference

Maintains an OpenGL shader object. Realizes the RAII-idiom. More...

#include <Shader.h>

Public Member Functions

 Shader (unsigned int type, const std::string &src)
 Compiles src and creates new OpenGL shader object of type. More...
 
 ~Shader ()
 Deletes the maintained OpenGL shader object.
 

Public Attributes

const unsigned int id
 Identifies the maintained OpenGL shader object.
 
const unsigned int type
 Holds the type of the maintained OpenGL shader object. This is TYPE_VERTEX_SHADER, TYPE_GEOMETRY_SHADER or TYPE_FRAGMENT_SHADER usually.
 

Static Public Attributes

static const unsigned int TYPE_VERTEX_SHADER
 Indicates shader object of GL_VERTEX_SHADER type.
 
static const unsigned int TYPE_FRAGMENT_SHADER
 Indicates shader object of GL_FRAGMENT_SHADER type.
 
static const unsigned int TYPE_GEOMETRY_SHADER
 Indicates shader object of GL_GEOMETRY_SHADER type.
 

Detailed Description

Maintains an OpenGL shader object. Realizes the RAII-idiom.

See also
The concept of shaders is explained here.
Author
Leonid Kostrykin
Date
2009 - 2015

Definition at line 47 of file Shader.h.

Constructor & Destructor Documentation

◆ Shader()

Carna::base::Shader::Shader ( unsigned int  type,
const std::string &  src 
)

Compiles src and creates new OpenGL shader object of type.

Parameters
typeis usually TYPE_VERTEX_SHADER, TYPE_GEOMETRY_SHADER or TYPE_FRAGMENT_SHADER.
srcreferences the shader source code.
Exceptions
AssertionFailurethrown when creation of OpenGL shader object fails.
ShaderCompilationErrorthrown when shader compilation fails.

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