ClanLib  2.3.7
List of all members
CL_ShaderObject Class Reference

Shader Object. More...

#include <shader_object.h>

Public Member Functions

Attributes
unsigned int get_handle () const
 Returns the OpenGL shader handle. More...
 
CL_ShaderType get_shader_type () const
 Gets the shader type. More...
 
CL_String get_info_log () const
 Get shader object's info log. More...
 
CL_String get_shader_source () const
 Get shader source code. More...
 
bool is_null () const
 Returns true if this object is invalid. More...
 
void throw_if_null () const
 Throw an exception if this object is invalid. More...
 
CL_ShaderObjectProviderget_provider () const
 Get Provider. More...
 
Operations
bool operator== (const CL_ShaderObject &other) const
 Handle comparison operator. More...
 
bool compile ()
 Compile program. More...
 

Construction

 CL_ShaderObject ()
 Constructs a null instance. More...
 
 CL_ShaderObject (CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &source)
 Constructs an OpenGL shader. More...
 
 CL_ShaderObject (CL_GraphicContext &gc, CL_ShaderType type, const std::vector< CL_StringRef > &sources)
 Constructs a ShaderObject. More...
 
 CL_ShaderObject (CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const CL_StringRef &source)
 Constructs a ShaderObject. More...
 
 CL_ShaderObject (CL_GraphicContextProvider *gc_provider, CL_ShaderType type, const std::vector< CL_StringRef > &sources)
 Constructs a ShaderObject. More...
 
virtual ~CL_ShaderObject ()
 
static CL_ShaderObject load (CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources)
 Load. More...
 
static CL_ShaderObject load (CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory)
 Load. More...
 
static CL_ShaderObject load (CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &fullname)
 Load. More...
 
static CL_ShaderObject load (CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file)
 Load. More...
 
static CL_ShaderObject load_and_compile (CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename, const CL_VirtualDirectory &directory)
 Load and compile. More...
 
static CL_ShaderObject load_and_compile (CL_GraphicContext &gc, CL_ShaderType type, const CL_StringRef &filename)
 Load and compile. More...
 
static CL_ShaderObject load_and_compile (CL_GraphicContext &gc, CL_ShaderType type, CL_IODevice &file)
 Load and compile. More...
 

Detailed Description

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. CL_ShaderObject is ClanLib's C++ interface to OpenGL shader objects.

Constructor & Destructor Documentation

CL_ShaderObject::CL_ShaderObject ( )

Constructs a null instance.

CL_ShaderObject::CL_ShaderObject ( CL_GraphicContext gc,
CL_ShaderType  type,
const CL_StringRef source 
)

Constructs an OpenGL shader.

Parameters
typeShader type. Can be cl_shadertype_vertex or cl_shadertype_fragment.
sourceShader source code, in OpenGL Shader Language (GLSL).
gcGraphics context in which to create the shader object
CL_ShaderObject::CL_ShaderObject ( CL_GraphicContext gc,
CL_ShaderType  type,
const std::vector< CL_StringRef > &  sources 
)

Constructs a ShaderObject.

Parameters
gc= Graphic Context
type= Shader Type
sources= sources
CL_ShaderObject::CL_ShaderObject ( CL_GraphicContextProvider gc_provider,
CL_ShaderType  type,
const CL_StringRef source 
)

Constructs a ShaderObject.

Parameters
gc_provider= Graphic Context Provider
type= Shader Type
source= String Ref
CL_ShaderObject::CL_ShaderObject ( CL_GraphicContextProvider gc_provider,
CL_ShaderType  type,
const std::vector< CL_StringRef > &  sources 
)

Constructs a ShaderObject.

Parameters
gc_provider= Graphic Context Provider
type= Shader Type
sources= sources
virtual CL_ShaderObject::~CL_ShaderObject ( )
virtual

Member Function Documentation

bool CL_ShaderObject::compile ( )

Compile program.

If the compiling fails, get_info_log() will return the compile log.

unsigned int CL_ShaderObject::get_handle ( ) const

Returns the OpenGL shader handle.

CL_String CL_ShaderObject::get_info_log ( ) const

Get shader object's info log.

CL_ShaderObjectProvider* CL_ShaderObject::get_provider ( ) const

Get Provider.

Returns
provider
CL_String CL_ShaderObject::get_shader_source ( ) const

Get shader source code.

CL_ShaderType CL_ShaderObject::get_shader_type ( ) const

Gets the shader type.

bool CL_ShaderObject::is_null ( ) const
inline

Returns true if this object is invalid.

static CL_ShaderObject CL_ShaderObject::load ( CL_GraphicContext gc,
const CL_StringRef resource_id,
CL_ResourceManager resources 
)
static

Load.

Parameters
gc= Graphic Context
resource_id= String Ref
resources= Resource Manager
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load ( CL_GraphicContext gc,
CL_ShaderType  type,
const CL_StringRef filename,
const CL_VirtualDirectory directory 
)
static

Load.

Parameters
gc= Graphic Context
type= Shader Type
filename= String Ref
directory= Virtual Directory
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load ( CL_GraphicContext gc,
CL_ShaderType  type,
const CL_StringRef fullname 
)
static

Load.

Parameters
gc= Graphic Context
type= Shader Type
fullname= String Ref
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load ( CL_GraphicContext gc,
CL_ShaderType  type,
CL_IODevice file 
)
static

Load.

Parameters
gc= Graphic Context
type= Shader Type
file= IODevice
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load_and_compile ( CL_GraphicContext gc,
CL_ShaderType  type,
const CL_StringRef filename,
const CL_VirtualDirectory directory 
)
static

Load and compile.

Parameters
gc= Graphic Context
type= Shader Type
filename= String Ref
directory= Virtual Directory
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load_and_compile ( CL_GraphicContext gc,
CL_ShaderType  type,
const CL_StringRef filename 
)
static

Load and compile.

Parameters
gc= Graphic Context
type= Shader Type
filename= String Ref
Returns
Shader Object
static CL_ShaderObject CL_ShaderObject::load_and_compile ( CL_GraphicContext gc,
CL_ShaderType  type,
CL_IODevice file 
)
static

Load and compile.

Parameters
gc= Graphic Context
type= Shader Type
file= IODevice
Returns
Shader Object
bool CL_ShaderObject::operator== ( const CL_ShaderObject other) const

Handle comparison operator.

void CL_ShaderObject::throw_if_null ( ) const

Throw an exception if this object is invalid.


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