LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
LibCarna::base::Shader Class Reference

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

#include <Shader.hpp>

Public Member Functions

 Shader (unsigned int type, const std::string &src)
 Compiles src and creates new OpenGL shader object of type.
 
 ~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

Definition at line 47 of file Shader.hpp.

Constructor & Destructor Documentation

◆ Shader()

LibCarna::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.

Member Data Documentation

◆ id

const unsigned int LibCarna::base::Shader::id

Identifies the maintained OpenGL shader object.

Definition at line 91 of file Shader.hpp.

◆ type

const unsigned int LibCarna::base::Shader::type

Holds the type of the maintained OpenGL shader object. This is TYPE_VERTEX_SHADER, TYPE_GEOMETRY_SHADER or TYPE_FRAGMENT_SHADER usually.

Definition at line 98 of file Shader.hpp.

◆ TYPE_FRAGMENT_SHADER

const unsigned int LibCarna::base::Shader::TYPE_FRAGMENT_SHADER
static

Indicates shader object of GL_FRAGMENT_SHADER type.

Definition at line 65 of file Shader.hpp.

◆ TYPE_GEOMETRY_SHADER

const unsigned int LibCarna::base::Shader::TYPE_GEOMETRY_SHADER
static

Indicates shader object of GL_GEOMETRY_SHADER type.

Definition at line 66 of file Shader.hpp.

◆ TYPE_VERTEX_SHADER

const unsigned int LibCarna::base::Shader::TYPE_VERTEX_SHADER
static

Indicates shader object of GL_VERTEX_SHADER type.

Definition at line 64 of file Shader.hpp.


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