Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
For internal use only. More...
#include <GLSL.hpp>
Public Member Functions | |
GLSLShader () | |
GLSLShader (EShaderType type, const String &source_or_path) | |
~GLSLShader () | |
void | setType (EShaderType type) |
EShaderType | type () const |
void | setSource (const String &source_or_path) |
Sets the sources for this shader and schedules a recompilation for it. If the string passed is a file path the source is loaded from it. | |
const std::string & | source () const |
Returns the sources for this shader. | |
void | setPath (const char *path) |
The path from which the shader was loaded. | |
const std::string & | path () const |
The path from which the shader was loaded. | |
std::string | getShaderSource () const |
Retrieves the shader source using glGetShaderSource() | |
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 |
std::string | mPath |
unsigned int | mHandle |
bool | mCompiled |
For internal use only.
Base class for GLSLVertexShader, GLSLFragmentShader, GLSLGeometryShader, GLSLTessEvaluationShader and GLSLTessControlShader.
Definition at line 80 of file GLSL.hpp.
GLSLShader::GLSLShader | ( | ) |
Definition at line 44 of file GLSL.cpp.
References mCompiled, mHandle, mType, vl::ST_VERTEX_SHADER, and VL_DEBUG_SET_OBJECT_NAME.
GLSLShader::GLSLShader | ( | EShaderType | type, |
const String & | source_or_path | ||
) |
Definition at line 52 of file GLSL.cpp.
References mCompiled, mHandle, mType, setSource(), type(), and VL_DEBUG_SET_OBJECT_NAME.
GLSLShader::~GLSLShader | ( | ) |
Definition at line 61 of file GLSL.cpp.
References deleteShader().
void vl::GLSLShader::setType | ( | EShaderType | type ) | [inline] |
EShaderType vl::GLSLShader::type | ( | ) | const [inline] |
Definition at line 93 of file GLSL.hpp.
Referenced by GLSLShader().
void GLSLShader::setSource | ( | const String & | source_or_path ) |
Sets the sources for this shader and schedules a recompilation for it. If the string passed is a file path the source is loaded from it.
Definition at line 85 of file GLSL.cpp.
References vl::String::count(), vl::String::empty(), vl::Log::error(), vl::String::loadText(), vl::locateFile(), vl::max(), mCompiled, mSource, vl::Object::setObjectName(), setPath(), and vl::String::toStdString().
Referenced by GLSLShader(), and vl::VLXClassWrapper_GLSLShader::importGLSLShader().
const std::string& vl::GLSLShader::source | ( | ) | const [inline] |
Returns the sources for this shader.
Definition at line 99 of file GLSL.hpp.
Referenced by compile(), and vl::VLXClassWrapper_GLSLShader::exportGLSLShader().
void vl::GLSLShader::setPath | ( | const char * | path ) | [inline] |
The path from which the shader was loaded.
Definition at line 102 of file GLSL.hpp.
Referenced by setSource().
const std::string& vl::GLSLShader::path | ( | ) | const [inline] |
The path from which the shader was loaded.
Definition at line 105 of file GLSL.hpp.
Referenced by vl::VLXClassWrapper_GLSLShader::exportGLSLShader().
std::string GLSLShader::getShaderSource | ( | ) | const |
Retrieves the shader source using glGetShaderSource()
Definition at line 66 of file GLSL.cpp.
References handle().
Referenced by vl::VLXClassWrapper_GLSLShader::exportGLSLShader().
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
Definition at line 125 of file GLSL.cpp.
References vl::Log::bug(), compileStatus(), vl::String::empty(), vl::Log::error(), handle(), vl::Has_GLSL, infoLog(), vl::log(), mCompiled, mHandle, mSource, mType, NULL, vl::Object::objectName(), source(), VL_CHECK, VL_CHECK_OGL, VL_TRAP, and vl::Log::warning().
Referenced by vl::GLSLProgram::attachShader().
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 180 of file GLSL.cpp.
References handle(), vl::Has_GLSL, 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 193 of file GLSL.cpp.
References handle(), vl::Has_GLSL, NULL, 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 215 of file GLSL.cpp.
References handle(), vl::Has_GLSL, 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 230 of file GLSL.cpp.
References handle(), vl::Has_GLSL, 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 128 of file GLSL.hpp.
Referenced by vl::GLSLProgram::attachShader(), compile(), compileStatus(), createShader(), deleteShader(), vl::GLSLProgram::detachShader(), vl::VLXClassWrapper_GLSLShader::exportGLSLShader(), getShaderSource(), and infoLog().
EShaderType vl::GLSLShader::mType [protected] |
Definition at line 131 of file GLSL.hpp.
Referenced by compile(), createShader(), and GLSLShader().
std::string vl::GLSLShader::mSource [protected] |
Definition at line 132 of file GLSL.hpp.
Referenced by compile(), and setSource().
std::string vl::GLSLShader::mPath [protected] |
unsigned int vl::GLSLShader::mHandle [protected] |
Definition at line 134 of file GLSL.hpp.
Referenced by compile(), createShader(), deleteShader(), and GLSLShader().
bool vl::GLSLShader::mCompiled [protected] |
Definition at line 135 of file GLSL.hpp.
Referenced by compile(), createShader(), deleteShader(), GLSLShader(), and setSource().