Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::GLProgram Class Reference

OpenGL shader class – responsible from compiling and linking GLSL fragments. More...

#include <mitsuba/hw/glprogram.h>

+ Inheritance diagram for mitsuba::GLProgram:

Public Member Functions

 GLProgram (const std::string &name="default")
 Construct a new (empty) shader. More...
 
void init ()
 Initialize the shader. More...
 
void bind ()
 Bind the shader. More...
 
void unbind ()
 Set the default shader program. More...
 
void cleanup ()
 Remove all related OpenGL handles. More...
 
int getParameterID (const std::string &name, bool failIfMissing=true) const
 Determine the ID number of a named parameter. More...
 
void setParameter (int id, bool value)
 Set a boolean parameter. More...
 
void setParameter (int id, Float value)
 Set a float parameter. More...
 
void setParameter (int id, int value)
 Set a integer parameter. More...
 
void setParameter (int id, uint32_t value)
 Set a unsigned integer parameter. More...
 
void setParameter (int id, const Vector &value)
 Set a Vector parameter. More...
 
void setParameter (int id, const Vector3i &value)
 Set a Vector3i parameter. More...
 
void setParameter (int id, const Vector2 &value)
 Set a Vector2 parameter. More...
 
void setParameter (int id, const Vector2i &value)
 Set a Vector2i parameter. More...
 
void setParameter (int id, const Vector4 &value)
 Set a Vector4 parameter. More...
 
void setParameter (int id, const Point &value)
 Set a Point parameter. More...
 
void setParameter (int id, const Point3i &value)
 Set a Point3i parameter. More...
 
void setParameter (int id, const Point2 &value)
 Set a Point2 parameter. More...
 
void setParameter (int id, const Point2i &value)
 Set a Point2i parameter. More...
 
void setParameter (int id, const Point4 &value)
 Set a Point4 parameter. More...
 
void setParameter (int id, const Matrix2x2 &value)
 Set a Matrix2x2 parameter. More...
 
void setParameter (int id, const Matrix3x3 &value)
 Set a Matrix3x3 parameter. More...
 
void setParameter (int id, const Matrix4x4 &value)
 Set a Matrix4x4 parameter. More...
 
void setParameter (int id, const Spectrum &value)
 Set a Spectrum parameter (will be converted to linear RGB) More...
 
void setParameter (int id, const Color3 &value)
 Set a Color3 parameter. More...
 
void setParameter (int id, const GPUTexture *value)
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from mitsuba::GPUProgram
 GPUProgram (const std::string &name="default")
 Create an empty program. More...
 
void setName (const std::string &name)
 Set the name of this program. More...
 
const std::string & getName () const
 Return the name of this program. More...
 
void setSource (EType type, const std::string &source)
 Set the source code of this program. More...
 
void setSourceFile (EType type, const fs::path &path)
 Set the source code of this program by filename. More...
 
const std::string & getSource (EType type) const
 Get the source code of this program. More...
 
void setParameter (const std::string &name, bool value, bool failIfMissing=true)
 Set a boolean parameter by name. More...
 
void setParameter (const std::string &name, int value, bool failIfMissing=true)
 Set a integer parameter by name. More...
 
void setParameter (const std::string &name, uint32_t value, bool failIfMissing=true)
 Set an unsigned integer parameter by name. More...
 
void setParameter (const std::string &name, Float value, bool failIfMissing=true)
 Set a float parameter by name. More...
 
void setParameter (const std::string &name, const Vector &value, bool failIfMissing=true)
 Set a Vector parameter by name. More...
 
void setParameter (const std::string &name, const Vector3i &value, bool failIfMissing=true)
 Set a Vector3i parameter by name. More...
 
void setParameter (const std::string &name, const Vector2 &value, bool failIfMissing=true)
 Set a Vector2 parameter by name. More...
 
void setParameter (const std::string &name, const Vector2i &value, bool failIfMissing=true)
 Set a Vector2i parameter by name. More...
 
void setParameter (const std::string &name, const Vector4 &value, bool failIfMissing=true)
 Set a Vector4 parameter by name. More...
 
void setParameter (const std::string &name, const Point &value, bool failIfMissing=true)
 Set a Point parameter by name. More...
 
void setParameter (const std::string &name, const Point3i &value, bool failIfMissing=true)
 Set a Point3i parameter by name. More...
 
void setParameter (const std::string &name, const Point2 &value, bool failIfMissing=true)
 Set a Point2 parameter by name. More...
 
void setParameter (const std::string &name, const Point2i &value, bool failIfMissing=true)
 Set a Point2i parameter by name. More...
 
void setParameter (const std::string &name, const Point4 &value, bool failIfMissing=true)
 Set a Point4 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix2x2 &value, bool failIfMissing=true)
 Set a Matrix2x2 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix3x3 &value, bool failIfMissing=true)
 Set a Matrix3x3 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix4x4 &value, bool failIfMissing=true)
 Set a Matrix4x4 parameter by name. More...
 
void setParameter (const std::string &name, const Transform &value, bool failIfMissing=true)
 Set a Transform parameter by name. More...
 
void setParameter (const std::string &name, const Color3 &value, bool failIfMissing=true)
 Set a Color3 parameter by name. More...
 
void setParameter (const std::string &name, const Spectrum &value, bool failIfMissing=true)
 Set a Spectrum parameter (will be converted to linear RGB) by name. More...
 
void setParameter (const std::string &name, const GPUTexture *value, bool failIfMissing=true)
 
void setParameter (int id, const Transform &value)
 Set a Transform parameter. More...
 
std::string toString () const
 Return a string representation of this class. More...
 
int getMaxVertices () const
 Returns the max. number of vertices generated by the geometry shader. More...
 
void setMaxVertices (int maxVertices)
 Set the max. number of vertices generated by the geometry shader. More...
 
void setInputGeometryType (EGeometryType type)
 Set the input type of the geometry shader. More...
 
EGeometryType getInputGeometryType () const
 Return the input type of the geometry shader. More...
 
void setOutputGeometryType (EGeometryType type)
 Set the output type of the geometry shader. More...
 
EGeometryType getOutputGeometryType () const
 Return the output type of the geometry shader. More...
 
bool isBound () const
 
void define (const std::string &key, const std::string &value="")
 Create a preprocessor definition (must be used before 'init') More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::GPUProgram
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

int createShader (int type, const std::string &source)
 Create a shader from source code. More...
 
std::string getInfoLogShader (int id)
 Return the info log (shader) More...
 
std::string getInfoLogProgram ()
 Return the info log (program) More...
 
virtual ~GLProgram ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::GPUProgram
virtual ~GPUProgram ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Additional Inherited Members

- Public Types inherited from mitsuba::GPUProgram
enum  EType { EVertexProgram = 0, EFragmentProgram, EGeometryProgram }
 Denotes the different components of this program. More...
 
enum  EGeometryType {
  EPoints, ELines, ELineStrips, ETriangles,
  ETriangleStrips, EQuadrilaterals
}
 Common geometry shader input/output types. More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 
- Protected Attributes inherited from mitsuba::GPUProgram
std::string m_name
 
std::string m_source [3]
 
EGeometryType m_inputGeometryType
 
EGeometryType m_outputGeometryType
 
int m_maxVertices
 
bool m_bound
 
std::map< std::string,
std::string > 
m_definitions
 

Detailed Description

OpenGL shader class – responsible from compiling and linking GLSL fragments.

Constructor & Destructor Documentation

mitsuba::GLProgram::GLProgram ( const std::string &  name = "default")

Construct a new (empty) shader.

virtual mitsuba::GLProgram::~GLProgram ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

void mitsuba::GLProgram::bind ( )
virtual

Bind the shader.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::cleanup ( )
virtual

Remove all related OpenGL handles.

Implements mitsuba::GPUProgram.

int mitsuba::GLProgram::createShader ( int  type,
const std::string &  source 
)
protected

Create a shader from source code.

virtual const Class* mitsuba::GLProgram::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from mitsuba::GPUProgram.

std::string mitsuba::GLProgram::getInfoLogProgram ( )
protected

Return the info log (program)

std::string mitsuba::GLProgram::getInfoLogShader ( int  id)
protected

Return the info log (shader)

int mitsuba::GLProgram::getParameterID ( const std::string &  name,
bool  failIfMissing = true 
) const
virtual

Determine the ID number of a named parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::init ( )
virtual

Initialize the shader.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
bool  value 
)
virtual

Set a boolean parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
Float  value 
)
virtual

Set a float parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
int  value 
)
virtual

Set a integer parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
uint32_t  value 
)
virtual

Set a unsigned integer parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Vector value 
)
virtual

Set a Vector parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Vector3i value 
)
virtual

Set a Vector3i parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Vector2 value 
)
virtual

Set a Vector2 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Vector2i value 
)
virtual

Set a Vector2i parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Vector4 value 
)
virtual

Set a Vector4 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Point value 
)
virtual

Set a Point parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Point3i value 
)
virtual

Set a Point3i parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Point2 value 
)
virtual

Set a Point2 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Point2i value 
)
virtual

Set a Point2i parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Point4 value 
)
virtual

Set a Point4 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Matrix2x2 value 
)
virtual

Set a Matrix2x2 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Matrix3x3 value 
)
virtual

Set a Matrix3x3 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Matrix4x4 value 
)
virtual

Set a Matrix4x4 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Spectrum value 
)
virtual

Set a Spectrum parameter (will be converted to linear RGB)

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const Color3 value 
)
virtual

Set a Color3 parameter.

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::setParameter ( int  id,
const GPUTexture value 
)
virtual

Set a GPUTexture parameter. Must be executed after binding the texture to a texture unit

Implements mitsuba::GPUProgram.

void mitsuba::GLProgram::unbind ( )
virtual

Set the default shader program.

Implements mitsuba::GPUProgram.

Member Data Documentation

Class* mitsuba::GLProgram::m_theClass
static

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