BALL::VIEW::GLRenderer Class Reference
[Renderer]

GLRenderer Renderer which provides hardware accelerated OPENGL rendering. More...

#include <glRenderer.h>

Inheritance diagram for BALL::VIEW::GLRenderer:
Inheritance graph
[legend]

List of all members.


Classes

class WrongModes
WrongModes Exception class. More...

Public Types

enum StereoMode { NO_STEREO = 0, ACTIVE_STEREO, DUAL_VIEW_STEREO, DUAL_VIEW_DIFFERENT_DISPLAY_STEREO }
enum RenderMode { RENDER_MODE_UNDEFINED = 0, RENDER_MODE_SOLID, RENDER_MODE_TRANSPARENT, RENDER_MODE_ALWAYS_FRONT }
enum BufferMode { DIRECT_RENDERING = 0, DISPLAY_LISTS_RENDERING, REBUILD_DISPLAY_LISTS }
typedef unsigned int Name
Typedef for OPENGL names.

Public Member Functions

GLRenderer ()
Default Constructor.
virtual ~GLRenderer ()
Destructor.
virtual void clear ()
Explicit default initialization.
void dump (std::ostream &s, Size depth) const
Name getName (const GeometricObject &object)
GeometricObject * getObject (GLRenderer::Name name) const
virtual bool init (Scene &scene)
Initialization routines.
virtual bool init (const Stage &stage, float width, float height)
Initialise the renderer, e.g. the display lists.
virtual void setLights (bool reset_all=false)
Set the light sources according to the stage.
virtual void setSmoothLines (bool smooth_lines)
Should the lines in the line representation and the wireframe models be smoothed?
virtual bool getSmoothLines ()
Vector3 mapViewportTo3D (Position x, Position y)
Compute the 3D position on the view plane corresponding to point (x,y) on the view port.
Vector2 map3DToViewport (const Vector3 &vec)
Compute the 2D position on the screen corresponding to the 3D point vec.
void pickObjects1 (Position x1, Position y1, Position x2, Position y2)
Pick geometric objects.
void pickObjects2 (List< GeometricObject * > &objects)
Pick geometric objects method2.
void enterPickingMode ()
void exitPickingMode ()
void setSize (float width, float height)
Set the size of the display.
float getXScale () const
float getYScale () const
virtual void updateBackgroundColor ()
Update the background color from the stage.
void initTransparent ()
void initSolid ()
void initAlwaysFront ()
void setAntialiasing (bool state)
Enable or disable antialiasing.
void removeRepresentation (const Representation &rep)
Remove all VertexBuffer and DisplayLists for the given Representation.
void bufferRepresentation (const Representation &rep)
Buffer the visualisation for the given Representation into OpenGL VertexBuffer Objects and DisplayLists.
void drawBuffered (const Representation &rep)
Draw the visualisation of the given Representation from the VertexBuffers and a DisplayList.
bool hasDisplayListFor (const Representation &rep) const
Test if a Representation has a DisplayList.
void setStereoMode (StereoMode state)
StereoMode getStereoMode () const
RenderMode getRenderMode () const
void setRenderMode (RenderMode mode)
virtual void renderToBuffer (RenderTarget *renderTarget, BufferMode)
This function renders into the buffer of the RenderTarget which has to be made current before this function is called.
virtual bool render (const Representation &representation, bool for_display_list=false)
virtual void bufferingDependentRender_ (const Representation &repr, BufferMode mode)
bool isExtensionSupported (const String &extension) const
Test if a given opengl extension is supported by the current driver.
void clearVertexBuffersFor (Representation &rep)
bool vertexBuffersSupported () const
String getVendor ()
String getRenderer ()
String getOpenGLVersion ()
vector< String > getExtensions ()
bool enableVertexBuffers (bool state)
bool vertexBuffersEnabled () const
DrawingMode getDrawingMode () const
void initPerspective ()
void setColorRGBA_ (const ColorRGBA &color)
void vertexVector3_ (const Vector3 &v)
void updateCamera (const Camera *camera=0)
Update the camera position either from a given Camera, or from the default Stage.
void setupStereo (float eye_separation, float focal_length)
Sets this renderer as a part of a stereo setup.
Position createTextureFromGrid (const RegularData3D &grid, const ColorMap &map)
void removeTextureFor_ (const RegularData3D &grid)
void getFrustum (float &near, float &far, float &left, float &right, float &top, float &bottom)

Protected Types

typedef HashMap< const
GeometricObject *, Name >
NameHashMap
typedef HashMap< Name, const
GeometricObject * >
GeometricObjectHashMap
typedef HashMap< const
Representation
*, GLDisplayList * >
DisplayListHashMap
typedef HashMap< const
Representation *, vector
< MeshBuffer * > >
MeshBufferHashMap

Protected Member Functions

bool mapViewplaneToScreen_ ()
Maps the current viewplane to screen coordinates.
void renderRepresentation_ (const Representation &representation, bool for_display_list)
void renderRepresentations_ (BufferMode mode)
virtual void renderLabel_ (const Label &)
virtual void renderLine_ (const Line &)
Render a line.
virtual void renderMultiLine_ (const MultiLine &line)
Render an illuminated line.
virtual void renderMesh_ (const Mesh &)
Render a surface mesh.
virtual void renderQuadMesh_ (const QuadMesh &)
Render a quad mesh.
void initDrawingMeshes_ ()
void initDrawingOthers_ ()
virtual void renderRuler ()
Render a ruler.
virtual void renderPoint_ (const Point &)
Render a single point.
virtual void renderSimpleBox_ (const SimpleBox &)
Render a simple box (parallel to the axes).
virtual void renderBox_ (const Box &)
Render a box.
virtual void renderSphere_ (const Sphere &)
Render a sphere.
virtual void renderDisc_ (const Disc &)
Render a disc.
virtual void renderTube_ (const Tube &)
Render a tube.
virtual void renderTwoColoredLine_ (const TwoColoredLine &)
Render a line with two colors.
virtual void renderTwoColoredTube_ (const TwoColoredTube &)
Render a tube with two colors.
virtual void renderClippingPlane_ (const ClippingPlane &plane)
virtual void renderGridVisualisation_ (const GridVisualisation &vol)
Render a grid slice.
void setColor4ub_ (const GeometricObject &object)
void createSpheres_ ()
void createTubes_ ()
void createBoxes_ ()
void createDottedSphere_ (int precision)
void subdivideTriangle_ (Vector3 &v1, Vector3 &v2, Vector3 &v3, int precision)
void createLineBox_ ()
void createDotBox_ ()
void createSolidBox_ ()
void clearNames_ ()
void normalVector3_ (const Vector3 &v)
void translateVector3_ (const Vector3 &v)
void texCoordVector3_ (const Vector3 &v)
void scaleVector3_ (const Vector3 &v)
void rotateVector3Angle_ (const Vector3 &v, Real angle)
void scale_ (float f)
void initGLU_ (DrawingMode mode)
void generateIlluminationTexture_ (float ka, float kd, float kr, float shininess)
Position getTextureIndex_ (Position x, Position y, Position z, Size width, Size height)
void setupGridClipPlanes_ (const GridVisualisation &slice)

Protected Attributes

DrawingMode drawing_mode_
Index drawing_precision_
float near_
float far_
float left_
float right_
float top_
float bottom_
float x_scale_
float y_scale_
GLDisplayList * GL_spheres_list_
GLDisplayList * GL_tubes_list_
GLDisplayList * GL_boxes_list_
GLDisplayList * sphere_list_
GLDisplayList line_list_
GLuint line_texture_bind_
GLubyte line_tex_ [128][128][4]
GeometricObjectHashMap name_to_object_
NameHashMap object_to_name_
DisplayListHashMap display_lists_
MeshBufferHashMap rep_to_buffers_
Name all_names_
GLuint object_buffer_ [BALL_GLRENDERER_PICKING_NUMBER_OF_MAX_OBJECTS]
Vector3 normal_vector_
StereoMode stereo_
RenderMode render_mode_
bool use_vertex_buffer_
bool smooth_lines_
bool picking_mode_
ModelType model_type_
Position display_lists_index_
bool single_pick_
bool drawed_other_object_
bool drawed_mesh_
GLUquadricObj * GLU_quadric_obj_
HashMap< const RegularData3D
*, Position >
grid_to_texture_
GLuint cel_texture_

Friends

class Scene

Detailed Description

GLRenderer Renderer which provides hardware accelerated OPENGL rendering.

Member Enumeration Documentation

Enumerator:
DIRECT_RENDERING Render without display lists, directly to the Scene.
DISPLAY_LISTS_RENDERING Render the contents of the display lists.
REBUILD_DISPLAY_LISTS Rebuild the contents of the display lists and redraw them.

Enumerator:
ACTIVE_STEREO Stereo mode for shutter glasses.
DUAL_VIEW_STEREO Stereo mode for output on two projectors.
DUAL_VIEW_DIFFERENT_DISPLAY_STEREO Stereo mode for output on two projectors with one display per head.

Member Function Documentation

virtual bool BALL::VIEW::GLRenderer::init ( Scene & scene ) [virtual]

Initialization routines.

This method is called by Scene::initializeGL.

Reimplemented from BALL::VIEW::Renderer.

bool BALL::VIEW::GLRenderer::isExtensionSupported ( const String & extension ) const

Test if a given opengl extension is supported by the current driver.

Call this only after Scene::initializeGL();

bool BALL::VIEW::GLRenderer::mapViewplaneToScreen_ ( ) [protected]

Maps the current viewplane to screen coordinates.

Returns false if the projection matrix is not correctly initialized.

void BALL::VIEW::GLRenderer::pickObjects1 ( Position x1,
Position y1,
Position x2,
Position y2
)

Pick geometric objects.

Parameters:
x1,y1,x2,y2 the rectangle of the selection

void BALL::VIEW::GLRenderer::pickObjects2 ( List< GeometricObject * > & objects )

Pick geometric objects method2.

Call this method after pickObjects1 and rendering the representations.

Parameters:
objects returns the picked objects

virtual void BALL::VIEW::GLRenderer::renderRuler ( ) [protected, virtual]

Render a ruler.

If supported by the renderer implementation, this function will produce a simple ruler that is rendered together with the other representations. The main use of this function is in the edit mode, where it can help to straighten-up structures and to correctly estimate angles and distances.

Reimplemented from BALL::VIEW::Renderer.

virtual void BALL::VIEW::GLRenderer::renderToBuffer ( RenderTarget * renderTarget,
BufferMode
) [virtual]

This function renders into the buffer of the RenderTarget which has to be made current before this function is called.

Buffers are not automatically swapped afterwards!

void BALL::VIEW::GLRenderer::setupStereo ( float eye_separation,
float focal_length
) [virtual]

Sets this renderer as a part of a stereo setup.

eye_separation denotes the distance along the right vector used by this "eye".

Reimplemented from BALL::VIEW::Renderer.


Generated on Thu Aug 6 18:30:59 2009 for BALL by doxygen 1.5.8