VR-Forces 4.8 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 More...
 
virtual ~DtGlShader ()
 destroy the shader More...
 
virtual bool isValid () const
 a valid shader is one that is compiled without error and is ready to use in an OpenGL program More...
 
virtual unsigned int id () const
 the OpenGL ID of the internal OpenGL shader More...
 

Static Public Member Functions

static std::string loadShaderSource (const std::string &strFileName)
 static API functions More...
 
static void saveShaderSource (const std::string &strFileName, const std::string &strSource)
 Saves shader source code to a file. More...
 
static std::string fixVersionDirective (const std::string &shaderString)
 Moves the #version directive to the top of the shader string to prevent shader compilation errors. More...
 
static void deleteShaders (const std::vector< unsigned int > &shaderVector)
 Loop over the OpenGL shader ids in the shaderVector and deletes them from OpenGL. More...
 
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. More...
 

Protected Attributes

unsigned int myShaderID
 
bool myIsValid
 

Private Member Functions

 DtGlShader ()
 private default constructor. not allowed. More...
 
 DtGlShader (const DtGlShader &)
 prevent copy-construction More...
 
DtGlShaderoperator= (const DtGlShader &)
 prevent assignment More...
 

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 ( 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

virtual makVrv::DtGlShader::~DtGlShader ( )
virtual

destroy the shader

makVrv::DtGlShader::DtGlShader ( )
private

private default constructor. not allowed.

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

prevent copy-construction

Member Function Documentation

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

prevent assignment

virtual bool makVrv::DtGlShader::isValid ( ) const
virtual

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

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

the OpenGL ID of the internal OpenGL shader

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

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 Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)