Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::GLSLShader Class Reference

For internal use only. More...

#include <GLSL.hpp>

Inheritance diagram for vl::GLSLShader:
vl::Object vl::GLSLFragmentShader vl::GLSLGeometryShader vl::GLSLTessControlShader vl::GLSLTessEvaluationShader vl::GLSLVertexShader

List of all members.

Public Member Functions

 GLSLShader (EShaderType type, const String &source=String())
 ~GLSLShader ()
virtual const char * className ()
 Returns the name of the class.
EShaderType type () const
void setSource (const String &source)
 Sets the sources for this shader and schedules a recompilation for it.
const std::string & source () const
 Returns the sources for this shader.
bool compile ()
 Compiles the shader, see also http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml for more information.
bool compileStatus () const
 Returns true if the shader has been succesfully compiled.
String infoLog () const
 Returns a String object containing this shader's info log as returned by glGetShaderInfoLog(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml for more information.
void createShader ()
 Creates the shader using the OpenGL function glCreateShader(), see also http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml for more information.
void deleteShader ()
 Deletes the shader using the OpenGL function glDeleteShader(), see also http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml for more information.
unsigned int handle () const
 The handle of this OpenGL shader object as returned by glCreateShader()

Protected Attributes

EShaderType mType
std::string mSource
unsigned int mHandle
bool mCompiled

Detailed Description

For internal use only.

Base class for GLSLVertexShader, GLSLFragmentShader, GLSLGeometryShader, GLSLTessEvaluationShader and GLSLTessControlShader.

See also:
GLSLVertexShader, GLSLFragmentShader, GLSLGeometryShader, GLSLTessControlShader, GLSLTessEvaluationShader, GLSLProgram, Effect

Definition at line 50 of file GLSL.hpp.


Constructor & Destructor Documentation

GLSLShader::GLSLShader ( EShaderType  type,
const String source = String() 
)

Definition at line 44 of file GLSL.cpp.

References mCompiled, mHandle, mType, setSource(), type(), and VL_DEBUG_SET_OBJECT_NAME.

GLSLShader::~GLSLShader (  )

Definition at line 53 of file GLSL.cpp.

References deleteShader().


Member Function Documentation

virtual const char* vl::GLSLShader::className (  ) [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

Reimplemented in vl::GLSLVertexShader, vl::GLSLFragmentShader, vl::GLSLGeometryShader, vl::GLSLTessControlShader, and vl::GLSLTessEvaluationShader.

Definition at line 57 of file GLSL.hpp.

EShaderType vl::GLSLShader::type (  ) const [inline]

Definition at line 59 of file GLSL.hpp.

Referenced by GLSLShader().

void GLSLShader::setSource ( const String source )

Sets the sources for this shader and schedules a recompilation for it.

Definition at line 58 of file GLSL.cpp.

References vl::String::count(), vl::Log::error(), vl::String::loadText(), vl::locateFile(), vl::max(), mCompiled, mSource, vl::Object::setObjectName(), vl::String::toStdString(), and VL_TRAP.

Referenced by GLSLShader().

const std::string& vl::GLSLShader::source (  ) const [inline]

Returns the sources for this shader.

Definition at line 65 of file GLSL.hpp.

Referenced by compile().

bool GLSLShader::compile (  )
bool GLSLShader::compileStatus (  ) const

Returns true if the shader has been succesfully compiled.

The check is done using the OpenGL function glGetShaderiv(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetShader.xml for more information.

Definition at line 146 of file GLSL.cpp.

References GLEW_Has_Shading_Language_20, handle(), VL_CHECK, and VL_CHECK_OGL.

Referenced by compile().

String GLSLShader::infoLog (  ) const

Returns a String object containing this shader's info log as returned by glGetShaderInfoLog(), see also http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml for more information.

Definition at line 159 of file GLSL.cpp.

References GLEW_Has_Shading_Language_20, handle(), VL_CHECK, and VL_CHECK_OGL.

Referenced by compile().

void GLSLShader::createShader (  )

Creates the shader using the OpenGL function glCreateShader(), see also http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml for more information.

Definition at line 181 of file GLSL.cpp.

References GLEW_Has_Shading_Language_20, handle(), mCompiled, mHandle, mType, VL_CHECK, and VL_CHECK_OGL.

void GLSLShader::deleteShader (  )

Deletes the shader using the OpenGL function glDeleteShader(), see also http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml for more information.

Definition at line 196 of file GLSL.cpp.

References GLEW_Has_Shading_Language_20, handle(), mCompiled, mHandle, and VL_CHECK.

Referenced by ~GLSLShader().

unsigned int vl::GLSLShader::handle (  ) const [inline]

The handle of this OpenGL shader object as returned by glCreateShader()

Definition at line 85 of file GLSL.hpp.

Referenced by vl::GLSLProgram::attachShader(), compile(), compileStatus(), createShader(), deleteShader(), vl::GLSLProgram::detachShader(), and infoLog().


Member Data Documentation

Definition at line 88 of file GLSL.hpp.

Referenced by compile(), createShader(), and GLSLShader().

std::string vl::GLSLShader::mSource [protected]

Definition at line 89 of file GLSL.hpp.

Referenced by compile(), and setSource().

unsigned int vl::GLSLShader::mHandle [protected]

Definition at line 90 of file GLSL.hpp.

Referenced by compile(), createShader(), deleteShader(), and GLSLShader().

bool vl::GLSLShader::mCompiled [protected]

Definition at line 91 of file GLSL.hpp.

Referenced by compile(), createShader(), deleteShader(), GLSLShader(), and setSource().


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

Visualization Library v2011.05.1144 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Tue Sep 13 2011 21:59:14.
Permission is granted to use this page to write and publish articles regarding Visualization Library.