proj home

Files   Classes   Functions   Hierarchy  

graphicsImmediateDeferred Class Reference

Display a scene where some geometry can be pre rendered. More...

#include <graphicsImmediateDeferred.h>

Inheritance diagram for graphicsImmediateDeferred:
Collaboration diagram for graphicsImmediateDeferred:

List of all members.

Public Member Functions

 graphicsImmediateDeferred ()
 The containers by default delete their contents.
void draw ()
 Draw to the global graphics stream.
virtual void update ()
 When the static geometry changes the scene is recalculated.

Public Attributes

gobjContainer gdynamic
 The deferred graphics is written here on update.
gobjContainer graphicsDeferred
 Drawn when update() called.
gobjContainer graphicsImmediate
 Always draw what is in this container.
bool drawDeferredFirst
 Can swap the draw order.


Detailed Description

Display a scene where some geometry can be pre rendered.

There are two types of graphics, pre rendered graphics and immediate graphics. The client pushes gobjs to graphicsDeferred and graphicsImmediate repsectively.

Motivation comes when graphics changes infrequently and when rendering it immediately is costly.

By having two graphics containers, one for immediate graphics which is evaluated every time draw() is called, and another for infrequently changing graphics which when update is called draw() is called.

Use:

Push gobj's constructed with new onto graphicsDeferred and graphicsImmediate as by default memory management is enabled.

gobj's in the deferred container should write to the global graphics stream with gobjpush(new gobj..). Because when graphicsDeferred.draw() is called the graphics needs to be created.

For example immediate graphics can use direct OpenGL calls. Whereas deferred could push graphics constructed with gobj's which wrap the OpenGL calls.

Deferred graphics is simply graphics that is less frequently updated.

Definition at line 44 of file graphicsImmediateDeferred.h.


Constructor & Destructor Documentation

graphicsImmediateDeferred::graphicsImmediateDeferred (  ) 

The containers by default delete their contents.

Definition at line 4 of file graphicsImmediateDeferred.cpp.

00005   : gdynamic(true), graphicsDeferred(true), 
00006     graphicsImmediate(true), drawDeferredFirst(true)
00007 {
00008 }


Member Function Documentation

void graphicsImmediateDeferred::draw (  )  [virtual]

Draw to the global graphics stream.

Implements gobj.

Definition at line 10 of file graphicsImmediateDeferred.cpp.

References gobjContainer::draw(), drawDeferredFirst, gdynamic, GOBJDEBUGCODE, and graphicsImmediate.

Referenced by mazedisp03::draw().

00011 {
00012   GOBJDEBUGCODE
00013   glPushAttrib(GL_CURRENT_BIT);
00014   glPushAttrib(GL_LIGHTING_BIT);
00015 
00016   if (drawDeferredFirst)
00017   {
00018     gdynamic.draw();
00019     graphicsImmediate.draw();
00020   }
00021   else
00022   {
00023     graphicsImmediate.draw();
00024     gdynamic.draw();
00025   }
00026 
00027   glPopAttrib();
00028   glPopAttrib();
00029 }

void graphicsImmediateDeferred::update (  )  [virtual]

When the static geometry changes the scene is recalculated.

Definition at line 31 of file graphicsImmediateDeferred.cpp.

References gobjContainer::draw(), gdynamic, gobj::global, graphicsDeferred, gobjContainer::nuke(), and gobjContainer::set().

Referenced by mazedisp03::construct(), simplexD1tessapp01::createdisplay(), graphicsImmediateDeferredTestTri::graphicscreate02(), graphicsImmediateDeferredTestTri::graphicscreate03(), graphicsImmediateDeferredTestTri::graphicscreate04(), graphicsImmediateDeferredTestTri::graphicscreate05(), graphicsImmediateDeferredTestTri::graphicscreate06(), graphicsImmediateDeferredTestTri::graphicscreate07(), simplexD2tessapp01::test02(), and delaunaysimpleD2test::test02().

00032 {
00033   gdynamic.nuke();
00034 cout << "graphicsImmedateDeferred::update()" << endl;
00035 
00036   assert(gobjContainer::global!=0);
00037   // Save the current global graphics stream.
00038   gobjContainer & g(*gobjContainer::global);
00039 
00040   // Make this the new graphics stream.
00041   gdynamic.set();
00042 
00043   // Writes all the graphics to gobjContainer::global
00044   graphicsDeferred.draw();  
00045 
00046   // Restore global graphics stream.
00047   g.set();  
00048 }


Member Data Documentation

Can swap the draw order.

Definition at line 60 of file graphicsImmediateDeferred.h.

Referenced by draw().

The deferred graphics is written here on update.

Definition at line 52 of file graphicsImmediateDeferred.h.

Referenced by draw(), and update().

Always draw what is in this container.

Definition at line 57 of file graphicsImmediateDeferred.h.

Referenced by tessD2disp02< TESS, PT, INDX >::displaymesh(), draw(), and graphicsImmediateDeferredSwitch::pushimmediate().


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

Generated on Fri Mar 4 00:50:02 2011 for Chelton Evans Source by  doxygen 1.5.8