| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/opengl/glcanvas.h>

Public Types | |
| enum | CanvasProperties { RGB_BUFFER = 1<<0, ALPHA_BUFFER = 1<<1, DEPTH_BUFFER = 1<<2, DOUBLE_BUFFER = 1<<3, STENCIL_BUFFER = 1<<4, ACCUM_BUFFER = 1<<5, STEREO_VIEWING = 1<<6, MULTISAMPLING = 1<<7, UBYTE_BUFFER = 0x0000, FLOAT_BUFFER = 0x0300, FLOAT16_BUFFER = 0x0100, FLOAT32_BUFFER = 0x0200, RGBA_BUFFER = RGB_BUFFER | ALPHA_BUFFER, RGBD = RGB_BUFFER | DEPTH_BUFFER, RGBDS = RGB_BUFFER | DEPTH_BUFFER | STENCIL_BUFFER, RGBDD = RGB_BUFFER | DEPTH_BUFFER | DOUBLE_BUFFER, RGBDDS = RGB_BUFFER | DEPTH_BUFFER | DOUBLE_BUFFER | STENCIL_BUFFER, RGBA = RGB_BUFFER | ALPHA_BUFFER, RGBAD = RGB_BUFFER | ALPHA_BUFFER | DEPTH_BUFFER, RGBADS = RGB_BUFFER | ALPHA_BUFFER | DEPTH_BUFFER | STENCIL_BUFFER, RGBADD = RGB_BUFFER | ALPHA_BUFFER | DEPTH_BUFFER | DOUBLE_BUFFER, RGBADDS = RGB_BUFFER | ALPHA_BUFFER | DEPTH_BUFFER | DOUBLE_BUFFER | STENCIL_BUFFER } |
| enum | BufferSelection { CURRENT_BUFFER = 0, FRONT_BUFFER, BACK_BUFFER, LEFT_BUFFER, RIGHT_BUFFER, FRONT_LEFT_BUFFER, FRONT_RIGHT_BUFFER, BACK_LEFT_BUFFER, BACK_RIGHT_BUFFER, AUX_BUFFER_0 = 20, AUX_BUFFER_1, AUX_BUFFER_2, AUX_BUFFER_3, AUX_BUFFER_4, AUX_BUFFER_5, AUX_BUFFER_6, AUX_BUFFER_7, COLOR_ATTACHMENT_BUFFER_0 = 80, COLOR_ATTACHMENT_BUFFER_1, COLOR_ATTACHMENT_BUFFER_2, COLOR_ATTACHMENT_BUFFER_3, COLOR_ATTACHMENT_BUFFER_4, COLOR_ATTACHMENT_BUFFER_5, COLOR_ATTACHMENT_BUFFER_6, COLOR_ATTACHMENT_BUFFER_7 } |
| enum | InfoAspects { GLVERSION = 1<<0, GLUVERSION = 1<<1, BUFFERS = 1<<2, BUFFERBITS = 1<<3, STACKDEPTHS = 1<<4, POINTLINEINFO = 1<<5, MISCINFO = 1<<6, ALL = GLVERSION | GLUVERSION | BUFFERS | BUFFERBITS | STACKDEPTHS | POINTLINEINFO | MISCINFO } |
Public Member Functions | |
| VRS_SERIALIZABLE_CLASS_ENUM (CanvasProperties) | |
| VRS_SERIALIZABLE_CLASS_ENUM (BufferSelection) | |
| virtual SO< Image > | snapshot (CanvasProperties buffer=GLCanvas::RGB_BUFFER, BufferSelection readBuffer=GLCanvas::CURRENT_BUFFER, const Area &subRegion=Area()) |
| virtual void | snapshot (SO< Image > destination, CanvasProperties buffer=GLCanvas::RGB_BUFFER, BufferSelection readBuffer=GLCanvas::CURRENT_BUFFER, const Area &subRegion=Area()) |
| virtual bool | largeScaleSnapshot (SO< Image > destination, CanvasProperties buffer=GLCanvas::RGB_BUFFER, SO< FrameBufferObjectGL > fbo=NULL) |
| virtual void | create () |
| virtual void | destroy () |
| virtual int | getProperties () const =0 |
| virtual bool | hasProperty (CanvasProperties prop) const |
| virtual Engine * | engine () const |
| returns the engine used to evaluate the scene graph of the canvas | |
| virtual TechniqueProcessor * | processor () const |
| returns the processor used to evaluate the scene graph of the canvas | |
| virtual void | createEngine () |
| virtual void | createProcessor () |
| virtual AttributeComposite * | standardGLSettings () const |
| VRS_SERIALIZABLE_CLASS_ENUM (InfoAspects) | |
| std::string | glInfo (int infoAspects=GLCanvas::ALL) |
| bool | hasExtension (const ID &extensionID) const |
| Checks for OpenGL extensions. | |
| bool | isVersion (int major, int minor) const |
| Checks for the OpenGL version number. | |
| void | allowSoftwareEmulation (bool onOff) |
| Specifies if software emulation is allowed. | |
| void | setSharedContextWith (GLCanvas *canvas) |
| Shares the context with the given canvas, set to NULL for no shared context. | |
| GLCanvas * | getSharedContextWith () const |
| Returns the canvas with which the context is shared, NULL if there is no context shared. | |
| virtual bool | prepareRedisplay () |
| called before OpenGL redisplay | |
| virtual void | finishRedisplay () |
| called after OpenGL redisplay | |
| VRS_TYPEINFO (GLCanvas, Canvas) | |
Protected Member Functions | |
| GLCanvas () | |
| virtual void | shareContext () |
| Should take care of making VRS aware of the shared context, called by create. | |
Protected Attributes | |
| SO< Engine > | engine_ |
| SO< TechniqueProcessor > | processor_ |
| VRS::GLCanvas::GLCanvas | ( | ) | [protected] |
| VRS::GLCanvas::VRS_SERIALIZABLE_CLASS_ENUM | ( | CanvasProperties | ) |
| VRS::GLCanvas::VRS_SERIALIZABLE_CLASS_ENUM | ( | BufferSelection | ) |
| virtual SO<Image> VRS::GLCanvas::snapshot | ( | CanvasProperties | buffer = GLCanvas::RGB_BUFFER, |
|
| BufferSelection | readBuffer = GLCanvas::CURRENT_BUFFER, |
|||
| const Area & | subRegion = Area() | |||
| ) | [virtual] |
| virtual void VRS::GLCanvas::snapshot | ( | SO< Image > | destination, | |
| CanvasProperties | buffer = GLCanvas::RGB_BUFFER, |
|||
| BufferSelection | readBuffer = GLCanvas::CURRENT_BUFFER, |
|||
| const Area & | subRegion = Area() | |||
| ) | [virtual] |
| virtual bool VRS::GLCanvas::largeScaleSnapshot | ( | SO< Image > | destination, | |
| CanvasProperties | buffer = GLCanvas::RGB_BUFFER, |
|||
| SO< FrameBufferObjectGL > | fbo = NULL | |||
| ) | [virtual] |
Copies the framebuffer into an image object. If no destination image is given, a new one will be created with. The subRegion parameter describes which (sub-)part of the framebuffer should be used. The format argument specifies which part of the framebuffer is copied; the following buffers are supported: RGB_BUFFER: color buffer without alpha (generates an RGB-image; Image::RGB) if no destination image is given), RGBA_BUFFER: color buffer with alpha (generates an RGBA-image; Image::RGBA) if no destination image is given), ALPHA_BUFFER: alpha buffer (generates an alpha-image; Image::A) if no destination image is given), STENCIL_BUFFER: stencil buffer (generates a luminance-image; Image::L) if no destination image is given), and DEPTH_BUFFER: depth buffer (generates a luminance-image; Image::L) if no destination image is given). If the snapshot is taken from the backbuffer, the scene is automatically rendered into the backbuffer but it does not get displayed, then the backbuffer is copied into the destination image. If the snapshot is taken from the front buffer, the current framebuffer contents are copied. The method "largeScaleSnapshot" renders the the scene multiple times in the backbuffer (if availabale), in order to create "really big" images (e.g. 10000x10000 pixels, or even more). The return value signals if the snapshot process was successful or not.
| virtual void VRS::GLCanvas::create | ( | ) | [virtual] |
Initializes the GLCanvas, so that the scene graph can be evaluated. An EngineGL is created and initialized. Also, a viewport attribute and a Processor are inserted at the beginning of the scene root node. create will also call shareContext (if there is a canvas to share the context with), which should take care of the necessary steps in order to actually share the openGL context. Note that there is standard implementation for shareContext which involves only the EngineGL setSharedContext-method. If the create method is overwritten, create should be called in the overriding create-method.
Reimplemented in VRS::GlutCanvas, and VRS::SDLCanvas.
| virtual void VRS::GLCanvas::destroy | ( | ) | [virtual] |
Cleans up the GLCanvas before destruction of the Canvas. Subclasses should call destroy in their destroy-method.
Reimplemented in VRS::GlutCanvas, and VRS::SDLCanvas.
| virtual int VRS::GLCanvas::getProperties | ( | ) | const [pure virtual] |
Gets the CanvasProperties of a GLCanvas. Must be implemented by subclasses.
Implemented in VRS::GlutCanvas, VRS::GtkCanvas, VRS::OffscreenCanvasGL, VRS::PBufferCanvasGL, and VRS::SDLCanvas.
| virtual bool VRS::GLCanvas::hasProperty | ( | CanvasProperties | prop | ) | const [virtual] |
Checks if the canvas has the given property.
| Engine * VRS::GLCanvas::engine | ( | ) | const [inline, virtual] |
| TechniqueProcessor * VRS::GLCanvas::processor | ( | ) | const [inline, virtual] |
| virtual void VRS::GLCanvas::createEngine | ( | ) | [virtual] |
Sets an engine that is used to evaluate the scene graph of the canvas. By default, an EngineGL-object is created, but subclasses may overwrite that.
| virtual void VRS::GLCanvas::createProcessor | ( | ) | [virtual] |
Sets a processor is be used to evaluate the scene graph of the canvas. By default, a TechniqueProcessorGL-object is created, but subclasses may overwrite that.
| virtual AttributeComposite* VRS::GLCanvas::standardGLSettings | ( | ) | const [virtual] |
Returns a set of standard settings used for rendering into an OpenGL canvas. I.e., the depth test and lighting is enabled, and material and face/line/point style are set to their standard values.
| VRS::GLCanvas::VRS_SERIALIZABLE_CLASS_ENUM | ( | InfoAspects | ) |
| std::string VRS::GLCanvas::glInfo | ( | int | infoAspects = GLCanvas::ALL |
) |
Returns a string with detailed informations about the OpenGL context used for this canvas.
| bool VRS::GLCanvas::hasExtension | ( | const ID & | extensionID | ) | const |
Checks for OpenGL extensions.
| bool VRS::GLCanvas::isVersion | ( | int | major, | |
| int | minor | |||
| ) | const |
Checks for the OpenGL version number.
| void VRS::GLCanvas::allowSoftwareEmulation | ( | bool | onOff | ) |
Specifies if software emulation is allowed.
| void VRS::GLCanvas::setSharedContextWith | ( | GLCanvas * | canvas | ) |
Shares the context with the given canvas, set to NULL for no shared context.
| GLCanvas* VRS::GLCanvas::getSharedContextWith | ( | ) | const |
Returns the canvas with which the context is shared, NULL if there is no context shared.
| virtual bool VRS::GLCanvas::prepareRedisplay | ( | ) | [virtual] |
called before OpenGL redisplay
invokes Canvas::prepareRedisplay and activates standard attributes for OpenGL rendering.
Reimplemented from VRS::Canvas.
Reimplemented in VRS::OffscreenCanvasGL, and VRS::PBufferCanvasGL.
| virtual void VRS::GLCanvas::finishRedisplay | ( | ) | [virtual] |
called after OpenGL redisplay
invokes Canvas::finishRedisplay and deactivates standard attributes for OpenGL rendering.
Reimplemented from VRS::Canvas.
Reimplemented in VRS::GlutCanvas, VRS::GtkCanvas, VRS::OffscreenCanvasGL, VRS::PBufferCanvasGL, and VRS::SDLCanvas.
| virtual void VRS::GLCanvas::shareContext | ( | ) | [protected, virtual] |
Should take care of making VRS aware of the shared context, called by create.
Note that making VRS aware of the shared context is not everything that is needed for actual sharing the context. At least you must also make openGL aware of the shared conext. Since this must be taken into account when creating the openGL context this will vary within the specialized openGL canvases and so each must take care of that on its own. Note that the standard implementation will only work if the canvas, the context should be shared with, also uses an EngineGL (sharing the context will propably not make much sense otherwise anyway).
SO<Engine> VRS::GLCanvas::engine_ [protected] |
SO<TechniqueProcessor> VRS::GLCanvas::processor_ [protected] |