version 3.3

VRS::PBufferCanvasGL Class Reference

PBuffer Canvas for OpenGL Rendering Engines. More...

#include <vrs/opengl/pbuffercanvasgl.h>

Inheritance diagram for VRS::PBufferCanvasGL:

VRS::GLCanvas VRS::Canvas VRS::Manager VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 PBufferCanvasGL (unsigned int width, unsigned int height, int properties=GLCanvas::RGBADS, GLCanvas *shareContextWith=NULL, bool useRenderToTexture=false, GLenum renderToTextureFormat=GL_RGBA, GLenum renderToTextureTarget=GL_TEXTURE_2D)
virtual ~PBufferCanvasGL ()
Texture2DGLgetContentTexture ()
Texture2DGLnewTexture (GLenum format=GL_ZERO, bool useMipmap=false)
void setCubeMapRenderTarget (CubeMapTextureGL::Side)
virtual void setSize (unsigned int width, unsigned int height)
virtual unsigned int getWidth () const
virtual unsigned int getHeight () const
virtual int getProperties () const
virtual bool prepareRedisplay ()
 called before OpenGL redisplay
virtual void finishRedisplay ()
 called after OpenGL redisplay
virtual void makeContextCurrent ()
 Hook for subclasses, should make the correct rendering context current.
virtual void releaseContext ()
 Hook for subclasses, should restore the old rendering context.
void updateTexture (Texture2DGL *texture=0)
void updateTextureArea (Texture2DGL *, const Area &)
void updateTexture (CubeMapTextureGL *texture, CubeMapTextureGL::Side, bool finished)
void releaseTexture (Texture2DGL *texture)
void releaseTexture (CubeMapTextureGL *texture)
 VRS_TYPEINFO (PBufferCanvasGL, GLCanvas)

Static Public Member Functions

static bool isSupported ()
static void disableSupport ()

Friends

class PBufferManagerGL


Detailed Description

PBuffer Canvas for OpenGL Rendering Engines.

Constructor & Destructor Documentation

VRS::PBufferCanvasGL::PBufferCanvasGL ( unsigned int  width,
unsigned int  height,
int  properties = GLCanvas::RGBADS,
GLCanvas shareContextWith = NULL,
bool  useRenderToTexture = false,
GLenum  renderToTextureFormat = GL_RGBA,
GLenum  renderToTextureTarget = GL_TEXTURE_2D 
)

The pbuffer canvas should share the context with other canvases in order to provide it contents to the other canvases via a shared texture object.

You must assure, that another GLCanvas (GlutCanvas, TclCanvas, etc.) is created before a pbuffer is used. (This is a bug and will hopefully be fixed.)

Experimental: if the boolean flag useRenderToTexture is set to true, the content of the pbuffer can be identified as texture. In this case, the pbuffer content does not need to be copied. If using this switch, renderToTextureFormat should be set to GL_RGB or GL_RGBA, depending on the texture format. Also, renderToTextureTarget should be GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB (the latter being *very* experimental!) Note that obviously, it is not possible to use the texture bound to the pbuffer when rendering into the same pbuffer. When the texture is not needed anymore and the pbuffer is going to be updated, the texture should be unbound using releaseTexture() (see below). With current NVidia drivers (29.42, 30.30), this is currently slower than the default texture copy, except for very high pbuffer resolutions of 2048x2048 or so. We expect that this is going to change with more mature drivers. For Linux, this extension is not implemented yet.

virtual VRS::PBufferCanvasGL::~PBufferCanvasGL (  )  [virtual]


Member Function Documentation

static bool VRS::PBufferCanvasGL::isSupported (  )  [static]

Checks if a pbuffer is supported by the OpenGL implementation.

static void VRS::PBufferCanvasGL::disableSupport (  )  [static]

Texture2DGL* VRS::PBufferCanvasGL::getContentTexture (  ) 

< Renders the scene graphs by an OpenGL engine. After the evaluation, the given texture is updated. Returns a texture which can be used by all canvases that share their contexts with the pbuffer canvas. Initially, the texture is empty. If redisplay is called, its contents get updated.

Texture2DGL* VRS::PBufferCanvasGL::newTexture ( GLenum  format = GL_ZERO,
bool  useMipmap = false 
)

Creates a new texture object containing the content of the color buffer; the mipmap flag signal if mipmaps should be automatically created for the texture (if it is supported by the hardware/driver).

void VRS::PBufferCanvasGL::setCubeMapRenderTarget ( CubeMapTextureGL::Side   ) 

For internal use only. If the experimenal renderToTexture-switch is used with a cube map pbuffer, the cube map side that the following rendering commands will affect is selected. Will be ignored if the renderToTexture switch is not used, but should not be used when the texture target is a 2d texture.

virtual void VRS::PBufferCanvasGL::setSize ( unsigned int  width,
unsigned int  height 
) [virtual]

sets the size of the PBufferCanvasGL

Implements VRS::Canvas.

virtual unsigned int VRS::PBufferCanvasGL::getWidth (  )  const [virtual]

gets the width of the PBufferCanvasGL

Implements VRS::Canvas.

virtual unsigned int VRS::PBufferCanvasGL::getHeight (  )  const [virtual]

gets the height of the PBufferCanvasGL

Implements VRS::Canvas.

virtual int VRS::PBufferCanvasGL::getProperties (  )  const [virtual]

returns the capabilities of the OpenGL framebuffer.

Implements VRS::GLCanvas.

virtual bool VRS::PBufferCanvasGL::prepareRedisplay (  )  [virtual]

called before OpenGL redisplay

invokes Canvas::prepareRedisplay and activates standard attributes for OpenGL rendering.

Reimplemented from VRS::GLCanvas.

virtual void VRS::PBufferCanvasGL::finishRedisplay (  )  [virtual]

called after OpenGL redisplay

invokes Canvas::finishRedisplay and deactivates standard attributes for OpenGL rendering.

Reimplemented from VRS::GLCanvas.

virtual void VRS::PBufferCanvasGL::makeContextCurrent (  )  [virtual]

Hook for subclasses, should make the correct rendering context current.

Since makeContextCurrent should be the first action in order to prepare a redisplay, it should use as least ressources as possible (e.g. the engine). The creation of the engine (and other ressources) can not be forced by this abstract base class, so there may be no engine when makeContextCurrent is called.

Reimplemented from VRS::Canvas.

virtual void VRS::PBufferCanvasGL::releaseContext (  )  [virtual]

Hook for subclasses, should restore the old rendering context.

Reimplemented from VRS::Canvas.

void VRS::PBufferCanvasGL::updateTexture ( Texture2DGL texture = 0  ) 

For internal use only. Copies the content of the pbuffer to the texture, or, if the experimental renderToTexture-switch is used, binds the content of the pbuffer as content of the texture.

void VRS::PBufferCanvasGL::updateTextureArea ( Texture2DGL ,
const Area  
)

For internal use only. Copies the area in the pbuffer to the corresponding area of the texture. If the texture is too small, a new texture is created. This method cannot be used with the renderToTexture-switch.

void VRS::PBufferCanvasGL::updateTexture ( CubeMapTextureGL texture,
CubeMapTextureGL::Side  ,
bool  finished 
)

For internal use only. Copies the content of the pbuffer to one side of the cube map texture, or, if the experimental renderToTexture-switch is used, and finished is true, binds the content of the pbuffer as content of the cube map texture.

void VRS::PBufferCanvasGL::releaseTexture ( Texture2DGL texture  ) 

For internal use only. If the experimenal renderToTexture-switch is used, the texture is released and the pbuffer can be written again. Will be ignored otherwise.

void VRS::PBufferCanvasGL::releaseTexture ( CubeMapTextureGL texture  ) 

For internal use only. If the experimenal renderToTexture-switch is used with a cube map pbuffer, the cube map texture is released and the pbuffer can be written again. Will be ignored otherwise.

VRS::PBufferCanvasGL::VRS_TYPEINFO ( PBufferCanvasGL  ,
GLCanvas   
)


Friends And Related Function Documentation

friend class PBufferManagerGL [friend]


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

Generated on Tue May 22 06:00:24 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact