CL_ShaderObject Class Reference
[clanDisplay Display]

Shader Object. More...

#include <shader_object.h>

List of all members.

Public Member Functions

Attributes

unsigned int get_handle () const
 Returns the OpenGL shader handle.
CL_ShaderType get_shader_type () const
 Gets the shader type.
CL_String get_info_log () const
 Get shader object's info log.
CL_String get_shader_source () const
 Get shader source code.
bool is_null () const
 Returns true if this object is invalid.
void throw_if_null () const
 Throw an exception if this object is invalid.
CL_ShaderObjectProviderget_provider () const
 Get Provider.
Operations

bool operator== (const CL_ShaderObject &other) const
 Handle comparison operator.
bool compile ()
 Compile program.

Construction



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

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:
type Shader type. Can be cl_shadertype_vertex or cl_shadertype_fragment.
source Shader source code, in OpenGL Shader Language (GLSL).
gc Graphics 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,
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 ( 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_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,
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,
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: