Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [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 ()
 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

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 80 of file GLSL.hpp.


Constructor & Destructor Documentation

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().


Member Function Documentation

void vl::GLSLShader::setType ( EShaderType  type ) [inline]

Definition at line 91 of file GLSL.hpp.

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 (  )
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().


Member Data Documentation

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]

Definition at line 133 of file GLSL.hpp.

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().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.