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

OpenGL implementation of the Renderer interface. More...

#include <mitsuba/hw/glrenderer.h>

+ Inheritance diagram for mitsuba::GLRenderer:

Public Member Functions

 GLRenderer (Session *session)
 Construct a new OpenGL rendering interface. More...
 
virtual void init (Device *device, Renderer *other=NULL)
 Initialize the renderer. More...
 
void reconfigure (const Device *device)
 Reconfigure the renderer for a certain device (e.g. after a resize event) More...
 
virtual void shutdown ()
 Shut the renderer down. More...
 
GPUTexturecreateGPUTexture (const std::string &name, Bitmap *bitmap=NULL)
 Create a new GPU texture object. More...
 
GPUGeometrycreateGPUGeometry (const Shape *shape)
 Create a new GPU geometry object. More...
 
GPUProgramcreateGPUProgram (const std::string &name)
 Create a new GPU program object. More...
 
GPUSynccreateGPUSync ()
 Create a new synchronization object. More...
 
void clear ()
 Clear the viewport. More...
 
void setCamera (const ProjectiveCamera *pCamera, const Point2 &apertureSample=Point2(0.5f), const Point2 &aaSample=Point2(0.5f), Float timeSample=0.5f)
 Configure the camera. More...
 
void setCamera (const Matrix4x4 &proj, const Matrix4x4 &view)
 Configure the camera (manual) More...
 
void setMatrix (EMatrixType type, const Matrix4x4 &value)
 Directly set the modelview or projection matrix. More...
 
Matrix4x4 getMatrix (EMatrixType type) const
 Fetch the currently set modelview or projection matrix. More...
 
void beginDrawingMeshes (bool transmitOnlyPositions=false)
 Set up the renderer for drawing triangle geometry. More...
 
void drawMesh (const TriMesh *geo)
 Send a triangle mesh to the renderer. More...
 
void drawMesh (const GPUGeometry *geo)
 Send a triangle mesh to the renderer. More...
 
void endDrawingMeshes ()
 Clean up the renderer after drawing triangle geometry. More...
 
void drawAll (const std::vector< TransformedGPUGeometry > &allGeometry)
 Quickly draw all geometry that has been registered with the renderer. More...
 
void blitTexture (const GPUTexture *texture, bool flipVertically=false, bool centerHoriz=true, bool centerVert=true, const Vector2i &offset=Vector2i(0, 0))
 Draw a quad using the given texture. More...
 
void blitQuad (bool flipVertically)
 Blit a screen-sized quad. More...
 
void drawText (const Point2i &pos, const Font *font, const std::string &text)
 
void setPointSize (Float size)
 Set the size of point primitives. More...
 
void drawPoint (const Point &p)
 Draw a point. More...
 
void drawLine (const Point &a, const Point &b)
 Draw a line between two specified points. More...
 
void drawPoint (const Point2 &p)
 Draw a point (2D) More...
 
void drawPoint (const Point2i &p)
 Draw a point (2D, integer coordinates) More...
 
void drawLine (const Point2 &a, const Point2 &b)
 Draw a line between two specified points (2D) More...
 
void drawLine (const Point2i &a, const Point2i &b)
 Draw a line between two specified points (2D, integer coordinates) More...
 
void drawRectangle (const Point2 &a, const Point2 &b)
 Draw a rectangle between two specified points (2D) More...
 
void drawRectangle (const Point2i &a, const Point2i &b)
 Draw a rectangle between two specified points (2D, integer coordinates) More...
 
void drawFilledRectangle (const Point2 &a, const Point2 &b)
 Draw a filled rectangle between two specified points (2D) More...
 
void drawFilledRectangle (const Point2i &a, const Point2i &b)
 Draw a filled rectangle between two specified points (2D, integer coordinates) More...
 
void drawEllipse (const Point &center, const Vector &axis1, const Vector &axis2)
 Draw an ellipse with the specified center and axes. More...
 
void drawAABB (const AABB &aabb)
 Draw a wire-frame axis-aligned box. More...
 
void setBlendMode (EBlendMode mode)
 Set the currently active blending mode. More...
 
void setCullMode (ECullMode mode)
 Set the currently active culling mode. More...
 
void setDepthMask (bool value)
 Activate or deactivate the writing of depth information. More...
 
void setDepthTest (bool value)
 Activate or deactivate depth testing. More...
 
void setColor (const Color3 &color, Float alpha=1.0f)
 Set the current fixed-function pipeline color. More...
 
void setColor (const Spectrum &spec, Float alpha=1.0f)
 Set the current fixed-function pipeline color. More...
 
void setClearDepth (Float depth)
 Set the depth value that is written by clear() More...
 
void setClearColor (const Color3 &color)
 Set the color value that is written by clear() More...
 
void clearTransforms ()
 Clear the view and projection transformations. More...
 
void flush ()
 Flush outstanding rendering commands. More...
 
void finish ()
 Completely finish outstanding rendering commands. More...
 
void checkError (bool onlyWarn=true)
 Check for any error indications. More...
 
void debugString (const std::string &text)
 Send a debug string to the rendering backend. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from mitsuba::Renderer
const RendererCapabilitiesgetCapabilities () const
 Return the renderer's capabilities. More...
 
ShaderregisterShaderForResource (const HWResource *res)
 
ShadergetShaderForResource (const HWResource *res)
 Look up a shader by the associated HWResource object. More...
 
void unregisterShaderForResource (const HWResource *res)
 Decrease the reference count of a shader. Deletes it when zero is reached. More...
 
GPUGeometryregisterGeometry (const Shape *shape)
 
bool unregisterGeometry (const Shape *shape)
 Unregister a triangle mesh from the renderer. More...
 
void setLogLevel (ELogLevel logLevel)
 Set the log level. More...
 
void setWarnLogLevel (ELogLevel logLevel)
 Set the log level for warnings. 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...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Attributes

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

Protected Member Functions

virtual ~GLRenderer ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::Renderer
 Renderer (Session *session)
 Construct a new OpenI rendering interface. More...
 
virtual ~Renderer ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

bool m_transmitOnlyPositions
 
bool m_normalsEnabled
 
bool m_texcoordsEnabled
 
bool m_tangentsEnabled
 
bool m_colorsEnabled
 
size_t m_queuedTriangles
 
int m_stride
 
- Protected Attributes inherited from mitsuba::Renderer
ref< Sessionm_session
 
ref< Devicem_device
 
ref< RendererCapabilitiesm_capabilities
 
std::map< const HWResource
*, ShaderRecord
m_shaders
 
std::map< const Shape
*, GPUGeometry * > 
m_geometry
 
bool m_initialized
 
bool m_borrowed
 
std::string m_driverVendor
 
std::string m_driverRenderer
 
std::string m_driverVersion
 
ELogLevel m_logLevel
 
ELogLevel m_warnLogLevel
 

Additional Inherited Members

- Public Types inherited from mitsuba::Renderer
enum  EBlendMode { EBlendNone = 0, EBlendAlpha, EBlendAdditive }
 
enum  ECullMode { ECullNone = 0, ECullFront, ECullBack }
 Possible culling modes. More...
 
enum  EMatrixType { EProjection = 0, EModelView }
 Matrices of the fixed function pipeline. More...
 
typedef std::pair< const
GPUGeometry *, Matrix4x4
TransformedGPUGeometry
 
- Static Public Member Functions inherited from mitsuba::Renderer
static Renderercreate (Session *session)
 
- 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...
 

Detailed Description

OpenGL implementation of the Renderer interface.

Constructor & Destructor Documentation

mitsuba::GLRenderer::GLRenderer ( Session session)

Construct a new OpenGL rendering interface.

virtual mitsuba::GLRenderer::~GLRenderer ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

void mitsuba::GLRenderer::beginDrawingMeshes ( bool  transmitOnlyPositions = false)
virtual

Set up the renderer for drawing triangle geometry.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::blitQuad ( bool  flipVertically)
virtual

Blit a screen-sized quad.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::blitTexture ( const GPUTexture texture,
bool  flipVertically = false,
bool  centerHoriz = true,
bool  centerVert = true,
const Vector2i offset = Vector2i(0, 0) 
)
virtual

Draw a quad using the given texture.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::checkError ( bool  onlyWarn = true)
virtual

Check for any error indications.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::clear ( )
virtual

Clear the viewport.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::clearTransforms ( )
virtual

Clear the view and projection transformations.

Implements mitsuba::Renderer.

GPUGeometry* mitsuba::GLRenderer::createGPUGeometry ( const Shape shape)
virtual

Create a new GPU geometry object.

Implements mitsuba::Renderer.

GPUProgram* mitsuba::GLRenderer::createGPUProgram ( const std::string &  name)
virtual

Create a new GPU program object.

Implements mitsuba::Renderer.

GPUSync* mitsuba::GLRenderer::createGPUSync ( )
virtual

Create a new synchronization object.

Implements mitsuba::Renderer.

GPUTexture* mitsuba::GLRenderer::createGPUTexture ( const std::string &  name,
Bitmap bitmap = NULL 
)
virtual

Create a new GPU texture object.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::debugString ( const std::string &  text)
virtual

Send a debug string to the rendering backend.

This is mainly useful when an OpenGL trace is captured by a tool such as 'apitrace'.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawAABB ( const AABB aabb)
virtual

Draw a wire-frame axis-aligned box.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawAll ( const std::vector< TransformedGPUGeometry > &  allGeometry)
virtual

Quickly draw all geometry that has been registered with the renderer.

Only transmits positions, hence this is mainly useful for shadow mapping.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawEllipse ( const Point center,
const Vector axis1,
const Vector axis2 
)
virtual

Draw an ellipse with the specified center and axes.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawFilledRectangle ( const Point2 a,
const Point2 b 
)
virtual

Draw a filled rectangle between two specified points (2D)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawFilledRectangle ( const Point2i a,
const Point2i b 
)
virtual

Draw a filled rectangle between two specified points (2D, integer coordinates)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawLine ( const Point a,
const Point b 
)
virtual

Draw a line between two specified points.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawLine ( const Point2 a,
const Point2 b 
)
virtual

Draw a line between two specified points (2D)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawLine ( const Point2i a,
const Point2i b 
)
virtual

Draw a line between two specified points (2D, integer coordinates)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawMesh ( const TriMesh geo)
virtual

Send a triangle mesh to the renderer.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawMesh ( const GPUGeometry geo)
virtual

Send a triangle mesh to the renderer.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawPoint ( const Point p)
virtual

Draw a point.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawPoint ( const Point2 p)
virtual

Draw a point (2D)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawPoint ( const Point2i p)
virtual

Draw a point (2D, integer coordinates)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawRectangle ( const Point2 a,
const Point2 b 
)
virtual

Draw a rectangle between two specified points (2D)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawRectangle ( const Point2i a,
const Point2i b 
)
virtual

Draw a rectangle between two specified points (2D, integer coordinates)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::drawText ( const Point2i pos,
const Font font,
const std::string &  text 
)
virtual

Draw a line of text on the screen. The coordinates are specified in pixel coordinates, where the upper left corner is the origin

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::endDrawingMeshes ( )
virtual

Clean up the renderer after drawing triangle geometry.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::finish ( )
virtual

Completely finish outstanding rendering commands.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::flush ( )
virtual

Flush outstanding rendering commands.

Implements mitsuba::Renderer.

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

Retrieve this object's class.

Reimplemented from mitsuba::Renderer.

Reimplemented in mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

Matrix4x4 mitsuba::GLRenderer::getMatrix ( EMatrixType  type) const
virtual

Fetch the currently set modelview or projection matrix.

Implements mitsuba::Renderer.

virtual void mitsuba::GLRenderer::init ( Device device,
Renderer other = NULL 
)
virtual

Initialize the renderer.

Reimplemented from mitsuba::Renderer.

Reimplemented in mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

void mitsuba::GLRenderer::reconfigure ( const Device device)
virtual

Reconfigure the renderer for a certain device (e.g. after a resize event)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setBlendMode ( EBlendMode  mode)
virtual

Set the currently active blending mode.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setCamera ( const ProjectiveCamera pCamera,
const Point2 apertureSample = Point2(0.5f),
const Point2 aaSample = Point2(0.5f),
Float  timeSample = 0.5f 
)
virtual

Configure the camera.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setCamera ( const Matrix4x4 proj,
const Matrix4x4 view 
)
virtual

Configure the camera (manual)

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setClearColor ( const Color3 color)
virtual

Set the color value that is written by clear()

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setClearDepth ( Float  depth)
virtual

Set the depth value that is written by clear()

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setColor ( const Color3 color,
Float  alpha = 1.0f 
)
virtual

Set the current fixed-function pipeline color.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setColor ( const Spectrum spec,
Float  alpha = 1.0f 
)
virtual

Set the current fixed-function pipeline color.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setCullMode ( ECullMode  mode)
virtual

Set the currently active culling mode.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setDepthMask ( bool  value)
virtual

Activate or deactivate the writing of depth information.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setDepthTest ( bool  value)
virtual

Activate or deactivate depth testing.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setMatrix ( EMatrixType  type,
const Matrix4x4 value 
)
virtual

Directly set the modelview or projection matrix.

Implements mitsuba::Renderer.

void mitsuba::GLRenderer::setPointSize ( Float  size)
virtual

Set the size of point primitives.

Implements mitsuba::Renderer.

virtual void mitsuba::GLRenderer::shutdown ( )
virtual

Shut the renderer down.

Reimplemented from mitsuba::Renderer.

Reimplemented in mitsuba::NSGLRenderer, mitsuba::WGLRenderer, and mitsuba::GLXRenderer.

Member Data Documentation

bool mitsuba::GLRenderer::m_colorsEnabled
protected
bool mitsuba::GLRenderer::m_normalsEnabled
protected
size_t mitsuba::GLRenderer::m_queuedTriangles
protected
int mitsuba::GLRenderer::m_stride
protected
bool mitsuba::GLRenderer::m_tangentsEnabled
protected
bool mitsuba::GLRenderer::m_texcoordsEnabled
protected
Class* mitsuba::GLRenderer::m_theClass
static
bool mitsuba::GLRenderer::m_transmitOnlyPositions
protected

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