Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::GLSLShader Class Reference

Base class for GLSLVertexShader, GLSLFragmentShader and GLSLGeometryShader. More...

#include <GLSL.hpp>

Inheritance diagram for vl::GLSLShader:

vl::Object vl::GLSLFragmentShader vl::GLSLGeometryShader 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 std::string &source)
 Sets the sources for this shader and schedules a recompilation for it.
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

Base class for GLSLVertexShader, GLSLFragmentShader and GLSLGeometryShader.

See also:
GLSLProgram, Shader, Effect, Actor

Constructor & Destructor Documentation

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

GLSLShader::~GLSLShader (  ) 


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, and vl::GLSLGeometryShader.

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

void GLSLShader::setSource ( const std::string &  source  ) 

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

void GLSLShader::setSource ( const String source  ) 

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

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

Returns the sources for this shader.

bool GLSLShader::compile (  ) 

Compiles the shader, see also http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml for more information.

This function also create the shader if handle() == 0 using the OpenGL function glCreateShader(), see also http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml

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.

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.

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.

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.

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

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


Member Data Documentation

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

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

bool vl::GLSLShader::mCompiled [protected]


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

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:17 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.