Shader Object. More...
#include <shader_object.h>
Public Member Functions | |
ShaderObject () | |
Constructs a null instance. | |
ShaderObject (GraphicContext &gc, ShaderType type, const std::string &source) | |
Constructs an OpenGL shader. | |
ShaderObject (GraphicContext &gc, ShaderType type, const std::vector< std::string > &sources) | |
Constructs a ShaderObject. | |
ShaderObject (GraphicContext &gc, ShaderType type, const void *source, int source_size) | |
Constructs a ShaderObject. | |
ShaderObject (GraphicContextProvider *gc_provider, ShaderType type, const std::string &source) | |
Constructs a ShaderObject. | |
ShaderObject (GraphicContextProvider *gc_provider, ShaderType type, const std::vector< std::string > &sources) | |
Constructs a ShaderObject. | |
virtual | ~ShaderObject () |
bool | compile () |
Compile program. | |
unsigned int | get_handle () const |
Returns the OpenGL shader handle. | |
std::string | get_info_log () const |
Get shader object's info log. | |
ShaderObjectProvider * | get_provider () const |
Get Provider. | |
std::string | get_shader_source () const |
Get shader source code. | |
ShaderType | get_shader_type () const |
Gets the shader type. | |
bool | is_null () const |
Returns true if this object is invalid. | |
operator bool () const | |
bool | operator== (const ShaderObject &other) const |
Handle comparison operator. | |
void | throw_if_null () const |
Throw an exception if this object is invalid. | |
Static Public Member Functions | |
static ShaderObject | load (GraphicContext &gc, const std::string &resource_id, const XMLResourceDocument &resources) |
Load. | |
static ShaderObject | load (GraphicContext &gc, ShaderType type, const std::string &filename, const FileSystem &fs) |
Load. | |
static ShaderObject | load (GraphicContext &gc, ShaderType type, const std::string &fullname) |
Load. | |
static ShaderObject | load (GraphicContext &gc, ShaderType type, IODevice &file) |
Load. | |
static ShaderObject | load_and_compile (GraphicContext &gc, ShaderType type, const std::string &filename) |
Load and compile. | |
static ShaderObject | load_and_compile (GraphicContext &gc, ShaderType type, const std::string &filename, const FileSystem &fs) |
Load and compile. | |
static ShaderObject | load_and_compile (GraphicContext &gc, ShaderType type, IODevice &file) |
Load and compile. | |
Shader Object.
The source code that makes up a program that gets executed by one of the programmable stages is encapsulated in one or more shader objects. Shader objects are attached to a program objects to form a programmable setup. ShaderObject is ClanLib's C++ interface to OpenGL shader objects.
clan::ShaderObject::ShaderObject | ( | ) |
Constructs a null instance.
clan::ShaderObject::ShaderObject | ( | GraphicContext & | gc, |
ShaderType | type, | ||
const std::string & | source | ||
) |
clan::ShaderObject::ShaderObject | ( | GraphicContext & | gc, |
ShaderType | type, | ||
const void * | source, | ||
int | source_size | ||
) |
Constructs a ShaderObject.
clan::ShaderObject::ShaderObject | ( | GraphicContext & | gc, |
ShaderType | type, | ||
const std::vector< std::string > & | sources | ||
) |
Constructs a ShaderObject.
gc | = Graphic Context |
type | = Shader Type |
sources | = sources |
clan::ShaderObject::ShaderObject | ( | GraphicContextProvider * | gc_provider, |
ShaderType | type, | ||
const std::string & | source | ||
) |
Constructs a ShaderObject.
gc_provider | = Graphic Context Provider |
type | = Shader Type |
source | = String Ref |
clan::ShaderObject::ShaderObject | ( | GraphicContextProvider * | gc_provider, |
ShaderType | type, | ||
const std::vector< std::string > & | sources | ||
) |
Constructs a ShaderObject.
gc_provider | = Graphic Context Provider |
type | = Shader Type |
sources | = sources |
|
virtual |
bool clan::ShaderObject::compile | ( | ) |
Compile program.
If the compiling fails, get_info_log() will return the compile log.
unsigned int clan::ShaderObject::get_handle | ( | ) | const |
Returns the OpenGL shader handle.
std::string clan::ShaderObject::get_info_log | ( | ) | const |
Get shader object's info log.
ShaderObjectProvider * clan::ShaderObject::get_provider | ( | ) | const |
Get Provider.
std::string clan::ShaderObject::get_shader_source | ( | ) | const |
Get shader source code.
ShaderType clan::ShaderObject::get_shader_type | ( | ) | const |
Gets the shader type.
|
inline |
Returns true if this object is invalid.
|
static |
Load.
gc | = Graphic Context |
resource_id | = String Ref |
resources | = Resource Manager |
|
static |
Load.
gc | = Graphic Context |
type | = Shader Type |
filename | = String Ref |
directory | = Virtual Directory |
|
static |
Load.
gc | = Graphic Context |
type | = Shader Type |
fullname | = String Ref |
|
static |
|
static |
Load and compile.
gc | = Graphic Context |
type | = Shader Type |
filename | = String Ref |
|
static |
Load and compile.
gc | = Graphic Context |
type | = Shader Type |
filename | = String Ref |
directory | = Virtual Directory |
|
static |
Load and compile.
gc | = Graphic Context |
type | = Shader Type |
file | = IODevice |
|
inlineexplicit |
bool clan::ShaderObject::operator== | ( | const ShaderObject & | other | ) | const |
Handle comparison operator.
void clan::ShaderObject::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.