VR-Forces 5.0.3 Developer's Guide
 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.

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)
 
virtual ~DtGlShader ()
 
virtual bool isValid () const
 
virtual unsigned int id () const
 

Static Public Member Functions

static std::string loadShaderSource (const std::string &strFileName, bool logWarning=true)
 
static void saveShaderSource (const std::string &strFileName, const std::string &strSource)
 
static std::string fixVersionDirective (const std::string &shaderString)
 
static void deleteShaders (const std::vector< unsigned int > &shaderVector)
 
static bool compileShader (const std::string &shader_name, const std::string &source, DtGlShaderType shaderType, unsigned int &shaderID)
 
static void printGLSLInfoLog (unsigned int shader)
 

Protected Attributes

unsigned int myShaderID
 
bool myIsValid
 

Private Member Functions

 DtGlShader ()
 
 DtGlShader (const DtGlShader &)
 
DtGlShaderoperator= (const DtGlShader &)
 

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,
bool  logWarning = true 
)
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.

static void makVrv::DtGlShader::printGLSLInfoLog ( unsigned int  shader)
static

debug function for printing the info log for a shader compilation

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 Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)