Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

vrvis::Drawable Class Reference

Class representing all things that can be drawn into the scene. More...

#include <Drawable.hpp>

Inheritance diagram for vrvis::Drawable:

vrvis::Layer vrvis::LayerComponent vrvis::Vis List of all members.

Public Member Functions

virtual ~Drawable (void)
 Virtual destructor.
Forwarded VR Juggler Callbacks
virtual void init (void)
 Initialize data.
virtual void contextInit (void)
 Initialize context data.
virtual void contextUpdate (void)
 Update context data.
virtual void draw (void)=0
 Draw this Drawable.
Status flags
virtual void show (void)
 Make this Drawable visible.
virtual void hide (void)
 Hide this Drawable.
bool isHidden (void) const
 Check the visibility status of this Drawable.
void setContextUpdateFlag (void)
 Set the "ContextUpdate" flag of this Drawable.

Static Public Member Functions

Forwarded VR Juggler Callbacks
void initAll (void)
 Call init() for all Drawables.
void contextInitAll (void)
 Call contextInit() for all Drawables.
void contextUpdateAll (void)
 Call contextUpdate() for all Drawables.
void drawAll (void)
 Call draw() for all Drawables that are not hidden.

Protected Member Functions

 Drawable (void)
Display List Management
int createListID (const std::string &crName)
 Create a new GL display list ID with a certain name.
int getListID (const std::string &crName)
 Access a GL display list ID through its name.
void drawAllLists (void)
 Call all GL display lists owned by this Drawable.

Detailed Description

Abstract base class representing each object that can be drawn in the scene. Contains functionality for GL context handling in single- and multi-context environments and options for GL draw list management. It also represents the connection to VR Juggler by providing methods that are called on specific times in the execution cycle. Every class that wants to draw something in the visualization has to be derived from Drawable.

Constructor & Destructor Documentation

Drawable::~Drawable void   )  [virtual]

Destructor. Frees all owned display lists.

Drawable::Drawable void   )  [protected]

Default constructor.

Member Function Documentation

void Drawable::contextInit void   )  [virtual]

Initializes OpenGL context data (display lists, textures, ...). Is called once for each GL context before entering the drawing loop. Does nothing by default, should be implemented by child classes if desired.

See also:
VRVis calling order

Reimplemented in vrvis::Layer, and vrvis::LayerComponent.

void Drawable::contextInitAll void   )  [static]

Calls the contextInit() method for each existing Drawable.

See also:

void Drawable::contextUpdate void   )  [virtual]

Updates GL context data. Is called once for each context for one VR Juggler frame if the "Context Update" flag is currently set. Does nothing in the default implementation, so you should override this in child classes and set the flag whenever needed.

See also:
VRVis calling cycle

Reimplemented in vrvis::LayerComponent.

void Drawable::contextUpdateAll void   )  [static]

Calls the contextUpdate() method for each existing Drawable which has its "Context Update" flag set.

See also:
setContextUpdateFlag(), VisApp::contextPreDraw()

int Drawable::createListID const std::string &  crName  )  [protected]

Creates a new context-sensitive display list ID for a given name. If a list with this name already exists, it is overwritten.

crName Name string to identify/access the created ID later.
GL display list ID.

Drawable::draw void   )  [pure virtual]

This must be implemented by child classes. In here, all the drawing of the scene should be done, if possible by using call lists filled in contextInit(). As you can't predict how often this method is called by VR Juggler, no calculations or changing of classes' internal state should be done in here.

See also:
VRVis calling cycle

Implemented in vrvis::Layer, vrvis::LayerComponent, and vrvis::Vis.

void Drawable::drawAll void   )  [static]

Applies the transformations of the draw matrices and draws all visible Drawables by calling draw().

See also:

void Drawable::drawAllLists void   )  [protected]

Calls the GL display list for each display list ID that this Drawable has created.

int Drawable::getListID const std::string &  crName  )  [protected]

Accesses a formerly created display list ID.

crName Name string to be looked up.
If name exists, the display list ID. 0 if not.

void Drawable::hide void   )  [virtual]

Unsets this Drawable's visibility flag, the Drawable is skipped when redrawing the scene.

void Drawable::init void   )  [virtual]

Initialization of data members that are not bound to a GL context (read in files, calculate, ...). Method is called exactly once before preparing the context and drawing. Default implementation does nothing, should be overridden by child classes if needed.

See also:
VRVis calling order

Reimplemented in vrvis::LayerComponent.

void Drawable::initAll void   )  [static]

Calls the init() method for each existing Drawable.

See also:

bool Drawable::isHidden void   )  const

Accesses this Drawable's visibility status.

True if the Drawable is hidden/invisible, false if not.

void Drawable::setContextUpdateFlag void   ) 

Sets this Drawable's "Context Update" flag, its contextUpdate() method is called once the next frame. The flag is unset after this one call!

void Drawable::show void   )  [virtual]

Sets this Drawable's visibility flag, resulting in the Drawable's drawing.

The documentation for this class was generated from the following files:
Generated on Tue Sep 21 07:31:11 2004 for VRVis by doxygen 1.3.8