Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
OpenGL Rendering

The BIAS OpenGL rendering framework is used to visualize generated 3D models and for Analysis-by-Synthesis algorithms.

It is capable to render models, images and 3D primitives in onscreen or offscreen contextes using given camera parameters, following the definition of the camera parameters and projections in BIAS/Geometry, (see Geometry / Transformations), including radial distortion.

glviewer_class_diagram.png

Rendering Contexts

There are 3 main render contextes which can be used to render objects. Two onscreen and own offscreen context. The render contextes share a common interface and the base class is BIAS::RenderContextBase. From BIAS::RenderContextBase the other contextes BIAS::ContextWX, BIAS::ContextGLUT and BIAS::ContextPBuffer are derived.

In BIAS::RenderContextBase a pointer to BIAS::GLProjectionParametersInterface is stored which holds the rendering parameters. See the next section for a desciption of the projection parameter concept.

Camera Parameters

The camera parameters in the BIAS OpenGL rendering framework follow the definition of BIAS::ProjectionParametersBase (see Camera Projection Concept) and the derived classes and are represented as "GLProjectionParameters". The class hierarchy is defined as follows:

A main interface class BIAS::GLProjectionParametersInterface is used as generic interface between rendering contextes, controllers and camera parameters. Every GLProjectionParameter... class is derived from BIAS::GLProjectionParametersInterface and the real BIAS::ProjectionParametersBase object pointer can be obtained by calling the BIAS::GLProjectionParametersInterface::GetMyselfAsProjectionParametersBase() function. The only camera paramter class currently implemented in BIAS is BIAS::ProjectionParametersPerspective which is capable to represent the standard projection matrix such as BIAS::PMatrix including radial distortion parameters.

Scenes

The representation of things that are to be drawn OpenGL is organized as a hierarchy of "Scenes" in BIAS. There is a base class called BIAS::SceneBase from which all other scenes are derived. The BIAS::RenderContextBase holds a vector of pointers to SceneBase objects. The central function in BIAS::SceneBase is the Draw() function in which for example OpenGL operations can be used to draw things in OpenGL.

To implement your own scene just derive from BIAS::SceneBase and overload the Draw() method.

Controller

In many applications using a GUI it is desirable to manipulate the current viewpoint to view the shown 3D content from another perspective or to edit the content or to make screenshots of the current view. For this purpose the BIAS uses "Controllers". Every controller has a controlled object which is mostly a BIAS::GLProjectionParametersInterface object. All controllers are derived from a common base class, the BIAS::ControlInterface.

OpenGL Viewers

There are two viewers currently implemented in BIAS to display 3D models. The first is based on the ContextGLUT and called biasGLviewerGLUT (see biasGLviewerGLUT.hh and biasGLviewerGLUT.cpp). The second is based on the ContextWX and called biasGLviewerWx (see biasGLviewerWx.hh and biasGLviewerWx.cpp). If BIAS is compiled with the OpenSceneGraph library (http://www.openscenegraph.org/) the viewers can be used to display all kinds of 3D models which are supported by OpenSceneGraph.

Author: Ingo Schiller