| globjects 1.0.0.000000000000 Strict OpenGL objects wrapper.

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
globjects::Shader Class Reference

Encapsulates OpenGL shaders. More...

`#include <globjects/include/globjects/Shader.h>`

Inheritance diagram for globjects::Shader:

## 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

## Detailed Description

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.

See also
  http://www.opengl.org/wiki/Shader
  Program
  ShaderSource
  ChangeListener
  Changeable

## Member Typedef Documentation

## ◆ IncludePaths

using globjects::Shader::IncludePaths = std::vector<std::string>

## Member Enumeration Documentation

## ◆ IncludeImplementation

enum globjects::Shader::IncludeImplementation
| strong

Enumerator
ShadingLanguageIncludeARB |
Fallback |

## Constructor & Destructor Documentation

## ◆ Shader() [1/2]

globjects::Shader::Shader | ( | const gl::GLenum | type | ) |

## ◆ Shader() [2/2]

globjects::Shader::Shader | ( | const gl::GLenum | type,
|  | AbstractStringSource * | source,
|  | const IncludePaths & | includePaths = `IncludePaths()`
| ) |  |

## ◆ ~Shader()

virtual globjects::Shader::~Shader | ( |  | ) |
| protected virtual

## Member Function Documentation

## ◆ hintIncludeImplementation()

static void globjects::Shader::hintIncludeImplementation | ( | IncludeImplementation | impl | ) |
| static

## ◆ fromString()

static Shader* globjects::Shader::fromString | ( | const gl::GLenum | type,
|  | const std::string & | sourceString,
|  | const IncludePaths & | includePaths = `IncludePaths()`
| ) |  |
| static

## ◆ fromFile()

static Shader* globjects::Shader::fromFile | ( | const gl::GLenum | type,
|  | const std::string & | filename,
|  | const IncludePaths & | includePaths = `IncludePaths()`
| ) |  |
| static

## ◆ globalReplace() [1/2]

static void globjects::Shader::globalReplace | ( | const std::string & | search,
|  | const std::string & | replacement
| ) |  |
| static

## ◆ globalReplace() [2/2]

static void globjects::Shader::globalReplace | ( | const std::string & | search,
|  | int | i
| ) |  |
| static

## ◆ clearGlobalReplacements()

static void globjects::Shader::clearGlobalReplacements | ( |  | ) |
| static

## ◆ accept()

virtual void globjects::Shader::accept | ( | ObjectVisitor & | visitor | ) |
| override virtual

Implements globjects::Object.

## ◆ type()

gl::GLenum globjects::Shader::type | ( |  | ) | const

## ◆ setSource() [1/2]

void globjects::Shader::setSource | ( | AbstractStringSource * | source | ) |

## ◆ setSource() [2/2]

void globjects::Shader::setSource | ( | const std::string & | source | ) |

## ◆ source()

const AbstractStringSource* globjects::Shader::source | ( |  | ) | const

## ◆ updateSource()

void globjects::Shader::updateSource | ( |  | ) |

## ◆ includePaths()

const IncludePaths& globjects::Shader::includePaths | ( |  | ) | const

## ◆ setIncludePaths()

void globjects::Shader::setIncludePaths | ( | const IncludePaths & | includePaths | ) |

## ◆ compile()

bool globjects::Shader::compile | ( |  | ) | const

## ◆ isCompiled()

bool globjects::Shader::isCompiled | ( |  | ) | const

## ◆ invalidate()

void globjects::Shader::invalidate | ( |  | ) |

## ◆ get()

gl::GLint globjects::Shader::get | ( | gl::GLenum | pname | ) | const

## ◆ getSource()

std::string globjects::Shader::getSource | ( |  | ) | const

## ◆ checkCompileStatus()

bool globjects::Shader::checkCompileStatus | ( |  | ) | const

## ◆ infoLog()

std::string globjects::Shader::infoLog | ( |  | ) | const

## ◆ typeString() [1/2]

std::string globjects::Shader::typeString | ( |  | ) | const

## ◆ objectType()

virtual gl::GLenum globjects::Shader::objectType | ( |  | ) | const
| override virtual

Implements globjects::Object.

## ◆ typeString() [2/2]

static std::string globjects::Shader::typeString | ( | gl::GLenum | type | ) |
| static

## ◆ notifyChanged()

virtual void globjects::Shader::notifyChanged | ( | const Changeable * | changeable | ) |
| override protected virtual

Reimplemented from globjects::ChangeListener.

## ◆ shaderString()

std::string globjects::Shader::shaderString | ( |  | ) | const
| protected

## Friends And Related Function Documentation

## ◆ Program

friend class Program
| friend

## Member Data Documentation

## ◆ m_type

gl::GLenum globjects::Shader::m_type
| protected

## ◆ m_source

ref_ptr<AbstractStringSource> globjects::Shader::m_source
| protected

## ◆ m_includePaths

IncludePaths globjects::Shader::m_includePaths
| protected

## ◆ m_compiled

bool globjects::Shader::m_compiled
| mutable protected

## ◆ m_compilationFailed

bool globjects::Shader::m_compilationFailed
| mutable protected

## ◆ s_globalReplacements

std::map<std::string, std::string> globjects::Shader::s_globalReplacements
| static protected

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

- Shader.h