globjects
1.1.0.2f0c753c8647
Strict OpenGL objects wrapper.
|
Encapsulates OpenGL shaders. More...
#include <globjects/include/globjects/Shader.h>
Public Types | |
enum | IncludeImplementation { IncludeImplementation::ShadingLanguageIncludeARB, IncludeImplementation::Fallback } |
using | IncludePaths = std::vector< std::string > |
Public Types inherited from globjects::Object | |
enum | NameImplementation { NameImplementation::DebugKHR, NameImplementation::Legacy } |
Public Member Functions | |
Shader (const gl::GLenum type) | |
Shader (const gl::GLenum type, AbstractStringSource *source, const IncludePaths &includePaths=IncludePaths()) | |
virtual void | accept (ObjectVisitor &visitor) override |
gl::GLenum | type () const |
void | setSource (AbstractStringSource *source) |
void | setSource (const std::string &source) |
const AbstractStringSource * | source () const |
void | updateSource () |
const IncludePaths & | includePaths () const |
void | setIncludePaths (const IncludePaths &includePaths) |
bool | compile () const |
bool | isCompiled () const |
void | invalidate () |
gl::GLint | get (gl::GLenum pname) const |
std::string | getSource () const |
bool | checkCompileStatus () const |
std::string | infoLog () const |
std::string | typeString () const |
virtual gl::GLenum | objectType () const override |
Public Member Functions inherited from globjects::Object | |
gl::GLuint | id () const |
std::string | name () const |
void | setName (const std::string &name) |
bool | hasName () const |
bool | isDefault () const |
void | detach () |
Public Member Functions inherited from globjects::Referenced | |
Referenced () | |
void | ref () const |
void | unref () const |
int | refCounter () const |
Public Member Functions inherited from globjects::HeapOnly | |
HeapOnly () | |
void | destroy () const |
Public Member Functions inherited from globjects::Changeable | |
void | changed () const |
void | registerListener (ChangeListener *listener) |
void | deregisterListener (ChangeListener *listener) |
Static Public Member Functions | |
static void | hintIncludeImplementation (IncludeImplementation impl) |
static Shader * | fromString (const gl::GLenum type, const std::string &sourceString, const IncludePaths &includePaths=IncludePaths()) |
static Shader * | fromFile (const gl::GLenum type, const std::string &filename, const IncludePaths &includePaths=IncludePaths()) |
static void | globalReplace (const std::string &search, const std::string &replacement) |
static void | globalReplace (const std::string &search, int i) |
static void | clearGlobalReplacements () |
static std::string | typeString (gl::GLenum type) |
Static Public Member Functions inherited from globjects::Object | |
static void | hintNameImplementation (NameImplementation impl) |
Protected Member Functions | |
virtual | ~Shader () |
virtual void | notifyChanged (const Changeable *changeable) override |
std::string | shaderString () const |
Protected Member Functions inherited from globjects::Object | |
Object (IDResource *resource) | |
virtual | ~Object () |
Protected Member Functions inherited from globjects::Referenced | |
virtual | ~Referenced () |
Protected Member Functions inherited from globjects::HeapOnly | |
virtual | ~HeapOnly () |
Protected Member Functions inherited from globjects::ChangeListener | |
virtual | ~ChangeListener () |
Protected Member Functions inherited from globjects::Changeable | |
void | changed () const |
void | registerListener (ChangeListener *listener) |
void | deregisterListener (ChangeListener *listener) |
Protected Attributes | |
gl::GLenum | m_type |
ref_ptr< AbstractStringSource > | m_source |
IncludePaths | m_includePaths |
bool | m_compiled |
bool | m_compilationFailed |
Protected Attributes inherited from globjects::Object | |
IDResource * | m_resource |
void * | m_objectLabelState |
Static Protected Attributes | |
static std::map< std::string, std::string > | s_globalReplacements |
Friends | |
class | Program |
Encapsulates OpenGL shaders.
A shader can be constructed using an AbstractStringSource. A shader can be attached to a program using Program::attach(). A Shader subclasses either ChangeListener and Changeable to react to changing shader sources and to propagate this change to ChangeListeners.
using globjects::Shader::IncludePaths = std::vector<std::string> |
|
strong |
globjects::Shader::Shader | ( | const gl::GLenum | type | ) |
globjects::Shader::Shader | ( | const gl::GLenum | type, |
AbstractStringSource * | source, | ||
const IncludePaths & | includePaths = IncludePaths() |
||
) |
|
protectedvirtual |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
overridevirtual |
Implements globjects::Object.
gl::GLenum globjects::Shader::type | ( | ) | const |
void globjects::Shader::setSource | ( | AbstractStringSource * | source | ) |
void globjects::Shader::setSource | ( | const std::string & | source | ) |
const AbstractStringSource* globjects::Shader::source | ( | ) | const |
void globjects::Shader::updateSource | ( | ) |
const IncludePaths& globjects::Shader::includePaths | ( | ) | const |
void globjects::Shader::setIncludePaths | ( | const IncludePaths & | includePaths | ) |
bool globjects::Shader::compile | ( | ) | const |
bool globjects::Shader::isCompiled | ( | ) | const |
void globjects::Shader::invalidate | ( | ) |
gl::GLint globjects::Shader::get | ( | gl::GLenum | pname | ) | const |
std::string globjects::Shader::getSource | ( | ) | const |
bool globjects::Shader::checkCompileStatus | ( | ) | const |
std::string globjects::Shader::infoLog | ( | ) | const |
std::string globjects::Shader::typeString | ( | ) | const |
|
overridevirtual |
Implements globjects::Object.
|
static |
|
overrideprotectedvirtual |
Reimplemented from globjects::ChangeListener.
|
protected |
|
friend |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
staticprotected |