VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
makVrv::DtGlShader Class Reference

A convenience class to represent an OpenGL Shader. More...

Public Types

enum  DtGlShaderType {
  VERTEX_SHADER = 0, TESSEVAL_SHADER, TESSCONTROL_SHADER, GEOMETRY_SHADER,
  FRAGMENT_SHADER, COMPUTE_SHADER
}

Public Member Functions

 DtGlShader (const std::string &name, const std::string &source, DtGlShaderType type)
 create a shader with a given name, from a string source of the given shader type
 ~DtGlShader ()
 destroy the shader
bool isValid () const
 a valid shader is one that is compiled without error and is ready to use in an OpenGL program
unsigned int id () const
 the OpenGL ID of the internal OpenGL shader

Static Public Member Functions

static std::string loadShaderSource (const std::string &strFileName)
 static API functions
static void saveShaderSource (const std::string &strFileName, const std::string &strSource)
 Saves shader source code to a file.
static std::string fixVersionDirective (const std::string &shaderString)
 Moves the #version directive to the top of the shader string to prevent shader compilation errors.
static void deleteShaders (const std::vector< unsigned int > &shaderVector)
 Loop over the OpenGL shader ids in the shaderVector and deletes them from OpenGL.
static bool compileShader (const std::string &shader_name, const std::string &source, DtGlShaderType shaderType, unsigned int &shaderID)
 Compiles a shader of type shaderType using source.

Protected Attributes

unsigned int myShaderID
bool myIsValid

Private Member Functions

 DtGlShader ()
 private default constructor
 DtGlShader (const DtGlShader &)
 prevent copy-construction
DtGlShaderoperator= (const DtGlShader &)
 prevent assignment

Detailed Description

A convenience class to represent an OpenGL Shader.

Member Enumeration Documentation

Enumerator:
VERTEX_SHADER 
TESSEVAL_SHADER 
TESSCONTROL_SHADER 
GEOMETRY_SHADER 
FRAGMENT_SHADER 
COMPUTE_SHADER 

Constructor & Destructor Documentation

makVrv::DtGlShader::DtGlShader ( )
private

private default constructor

makVrv::DtGlShader::DtGlShader ( const DtGlShader )
private

prevent copy-construction

makVrv::DtGlShader::DtGlShader ( const std::string &  name,
const std::string &  source,
DtGlShaderType  type 
)

create a shader with a given name, from a string source of the given shader type

makVrv::DtGlShader::~DtGlShader ( )

destroy the shader

Member Function Documentation

DtGlShader& makVrv::DtGlShader::operator= ( const DtGlShader )
private

prevent assignment

static std::string makVrv::DtGlShader::loadShaderSource ( const std::string &  strFileName)
static

static API functions

Loads shader source code from a file.

static void makVrv::DtGlShader::saveShaderSource ( const std::string &  strFileName,
const std::string &  strSource 
)
static

Saves shader source code to a file.

static std::string makVrv::DtGlShader::fixVersionDirective ( const std::string &  shaderString)
static

Moves the #version directive to the top of the shader string to prevent shader compilation errors.

static void makVrv::DtGlShader::deleteShaders ( const std::vector< unsigned int > &  shaderVector)
static

Loop over the OpenGL shader ids in the shaderVector and deletes them from OpenGL.

static bool makVrv::DtGlShader::compileShader ( const std::string &  shader_name,
const std::string &  source,
DtGlShaderType  shaderType,
unsigned int shaderID 
)
static

Compiles a shader of type shaderType using source.

shaderID is the new shader id Returns True is the compile succeeded

bool makVrv::DtGlShader::isValid ( ) const

a valid shader is one that is compiled without error and is ready to use in an OpenGL program

unsigned int makVrv::DtGlShader::id ( ) const

the OpenGL ID of the internal OpenGL shader

Member Data Documentation

unsigned int makVrv::DtGlShader::myShaderID
protected
bool makVrv::DtGlShader::myIsValid
protected

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)