Visualization Library 2.1.0
A 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. More... | |
const std::string & | source () const |
Returns the sources for this shader. More... | |
void | setPath (const String &path) |
The path from which the shader was loaded. More... | |
const String & | path () const |
The path from which the shader was loaded. More... | |
bool | reload () |
Reloads the shader source and recompiles it. Returns true on success. More... | |
std::string | getShaderSource () const |
Retrieves the shader source using glGetShaderSource() More... | |
bool | compile () |
Compiles the shader, see also http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml for more information. More... | |
bool | compileStatus () const |
Returns true if the shader has been succesfully compiled. More... | |
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. More... | |
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. More... | |
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. More... | |
unsigned int | handle () const |
The handle of this OpenGL shader object as returned by glCreateShader() More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Attributes | |
EShaderType | mType |
std::string | mSource |
String | mPath |
unsigned int | mHandle |
bool | mCompiled |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
For internal use only.
Base class for GLSLVertexShader, GLSLFragmentShader, GLSLGeometryShader, GLSLTessEvaluationShader and GLSLTessControlShader.
GLSLShader::GLSLShader | ( | ) |
GLSLShader::GLSLShader | ( | EShaderType | type, |
const String & | source_or_path | ||
) |
GLSLShader::~GLSLShader | ( | ) |
Definition at line 62 of file GLSL.cpp.
References deleteShader().
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 159 of file GLSL.cpp.
References vl::Log::bug(), compileStatus(), createShader(), vl::String::empty(), vl::Log::error(), handle(), vl::Has_GLSL, infoLog(), vl::log(), mCompiled, mSource, NULL, vl::Object::objectName(), VL_CHECK, VL_CHECK_OGL, and vl::Log::warning().
Referenced by vl::GLSLProgram::attachShader(), and reload().
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 214 of file GLSL.cpp.
References handle(), vl::Has_GLSL, 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 249 of file GLSL.cpp.
References handle(), vl::Has_GLSL, mCompiled, mHandle, mType, VL_CHECK, and VL_CHECK_OGL.
Referenced by vl::GLSLProgram::attachShader(), and compile().
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 264 of file GLSL.cpp.
References handle(), vl::Has_GLSL, mCompiled, mHandle, and VL_CHECK.
Referenced by ~GLSLShader().
std::string GLSLShader::getShaderSource | ( | ) | const |
Retrieves the shader source using glGetShaderSource()
Definition at line 67 of file GLSL.cpp.
References handle(), vl::String::loadText(), vl::String::printf(), source(), and vl::String::splitLines().
Referenced by vlX::VLXClassWrapper_GLSLShader::exportGLSLShader().
|
inline |
The handle of this OpenGL shader object as returned by glCreateShader()
Definition at line 104 of file GLSL.hpp.
Referenced by vl::GLSLProgram::applyUniformSet(), vl::GLSLProgram::attachShader(), vl::GLSLProgram::bindAttribLocation(), compile(), compileStatus(), vl::GLSLProgram::createProgram(), createShader(), vl::GLSLProgram::deleteProgram(), deleteShader(), vl::GLSLProgram::detachShader(), vl::GLSLProgram::discardAllShaders(), vlX::VLXClassWrapper_GLSLShader::exportGLSLShader(), vl::GLSLProgram::getProgramBinary(), getShaderSource(), infoLog(), vl::GLSLProgram::infoLog(), vl::GLSLProgram::linkProgram(), vl::GLSLProgram::linkStatus(), vl::GLSLProgram::programBinary(), vl::GLSLProgram::validateProgram(), and vl::GLSLProgram::~GLSLProgram().
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 227 of file GLSL.cpp.
References handle(), vl::Has_GLSL, NULL, VL_CHECK, and VL_CHECK_OGL.
Referenced by compile(), vl::GLSLProgram::linkProgram(), and vl::GLSLProgram::programBinary().
|
inline |
The path from which the shader was loaded.
Definition at line 78 of file GLSL.hpp.
Referenced by vlX::VLXClassWrapper_GLSLShader::exportGLSLShader(), and reload().
bool GLSLShader::reload | ( | ) |
Reloads the shader source and recompiles it. Returns true on success.
Definition at line 105 of file GLSL.cpp.
References compile(), vl::String::empty(), mPath, path(), and setSource().
|
inline |
The path from which the shader was loaded.
Definition at line 75 of file GLSL.hpp.
Referenced by setSource().
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 115 of file GLSL.cpp.
References vl::String::clear(), vl::String::count(), vl::String::empty(), vl::Log::error(), vl::String::loadText(), vl::locateFile(), vl::max(), mCompiled, mPath, mSource, vl::Object::setObjectName(), setPath(), vl::String::toStdString(), and VL_CHECK.
Referenced by GLSLShader(), vlX::VLXClassWrapper_GLSLShader::importGLSLShader(), and reload().
|
inline |
|
inline |
Returns the sources for this shader.
Definition at line 72 of file GLSL.hpp.
Referenced by vlX::VLXClassWrapper_GLSLShader::exportGLSLShader(), and getShaderSource().
|
inline |
Definition at line 66 of file GLSL.hpp.
Referenced by GLSLShader().
|
protected |
Definition at line 111 of file GLSL.hpp.
Referenced by compile(), createShader(), deleteShader(), GLSLShader(), and setSource().
|
protected |
Definition at line 110 of file GLSL.hpp.
Referenced by vl::GLSLProgram::createProgram(), createShader(), vl::GLSLProgram::deleteProgram(), deleteShader(), vl::GLSLProgram::GLSLProgram(), and GLSLShader().
|
protected |
Definition at line 109 of file GLSL.hpp.
Referenced by reload(), and setSource().
|
protected |
Definition at line 108 of file GLSL.hpp.
Referenced by compile(), and setSource().
|
protected |
Definition at line 107 of file GLSL.hpp.
Referenced by createShader(), and GLSLShader().
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:50.
© Copyright Michele Bosi. All rights reserved.