Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::GlApp Class Reference

GlApp: Encapulates an actual OpenGL application. More...

#include <GlApp.h>

Inheritance diagram for vrj::GlApp:

Inheritance graph
[legend]
Collaboration diagram for vrj::GlApp:

Collaboration graph
[legend]
List of all members.

Public Methods

 GlApp (Kernel *kern)
 GlApp ()
virtual ~GlApp ()
virtual void draw ()=0
 Function to draw the scene. More...

virtual void contextInit ()
 Function that is called immediately after a new context is created. More...

virtual void contextClose ()
 Function that is called immediately before a context is closed. More...

virtual void contextPreDraw ()
 Function that is called upon entry into the context for a draw. More...

virtual void contextPostDraw ()
 Function that is called upon exit of the context for a draw. More...

virtual void bufferPreDraw ()
 Function that is called once for each frame buffer of a gl context. More...

virtual void pipePreDraw ()
 Function that is called at the beginning of the drawing of each pipe. More...

Factory functions
virtual DrawManagergetDrawManager ()
 Get the DrawManager to use. More...


Detailed Description

GlApp: Encapulates an actual OpenGL application.

PURPOSE: This class defines the class that OpenGL application classes should be derived from. The interface given is the interface that the System expects in order to interface with the application.

The control loop will look similar to this:

NOTE: One time through the loop is a Juggler Frame

  contextInit();                 // called for each context
  while (drawing)
  {
     preFrame();
     bufferPreDraw();            // called for each draw buffer
     contextPreDraw();           // called for each context
     draw();                     // called for each surfacewindow
     contextPostDraw();          // called for each context
     intraFrame();               // called in parallel to the draw functions.
     sync();
     postFrame();

     UpdateTrackers();
  }

  contextClose();                // called for each context

See also:
App

Definition at line 82 of file GlApp.h.


Constructor & Destructor Documentation

vrj::GlApp::GlApp Kernel   kern [inline]
 

Definition at line 85 of file GlApp.h.

Referenced by vrj::OpenSGApp::OpenSGApp, and vrj::OsgApp::OsgApp.

00085                        : App(kern)
00086    {
00087       //api.setOpenGL();     // Tell everyone that we are OpenGL
00088    }

vrj::GlApp::GlApp   [inline]
 

Definition at line 90 of file GlApp.h.

00090 {;}

virtual vrj::GlApp::~GlApp   [inline, virtual]
 

Definition at line 92 of file GlApp.h.

00093    {
00094       /* Do nothing. */ ;
00095    }


Member Function Documentation

virtual void vrj::GlApp::draw   [pure virtual]
 

Function to draw the scene.

Override this function with the user draw routine.

Precondition:
OpenGL state has correct transformation and buffer selected.
Postcondition:
The current scene has been drawn.

Implemented in vrj::GlProcAppWrapper.

virtual void vrj::GlApp::contextInit   [inline, virtual]
 

Function that is called immediately after a new context is created.

Use this function to create context specific data structures. i.e. Display lists, Texture objects, etc.

Precondition:
The OpenGL context has been set to the new context.
Postcondition:
Application has completed in initialization the user wishes.

Reimplemented in vrj::GlProcAppWrapper.

Definition at line 110 of file GlApp.h.

00111    {;}

virtual void vrj::GlApp::contextClose   [inline, virtual]
 

Function that is called immediately before a context is closed.

Use the function to clean up any context data structures.

Reimplemented in vrj::OsgApp.

Definition at line 116 of file GlApp.h.

00117    {;}

virtual void vrj::GlApp::contextPreDraw   [inline, virtual]
 

Function that is called upon entry into the context for a draw.

Precondition:
The OpenGL context has been set to the context for drawing.
Postcondition:
User application has executed any commands that need to only be executed once per context, per frame.
Note:
This function can be used for things that need to happen every frame, but only once per context.
Ex: Dynamically Create display lists.

Reimplemented in vrj::OpenSGApp.

Definition at line 128 of file GlApp.h.

00129    {;}

virtual void vrj::GlApp::contextPostDraw   [inline, virtual]
 

Function that is called upon exit of the context for a draw.

Precondition:
The OpenGL context has been set to the context for drawing.

Reimplemented in vrj::OpenSGApp.

Definition at line 134 of file GlApp.h.

00135    {;}

virtual void vrj::GlApp::bufferPreDraw   [inline, virtual]
 

Function that is called once for each frame buffer of a gl context.

This function is executed after contextInit() (if needed) but before contextPreDraw(). It is called once per framebuffer (see note).

Precondition:
The OpenGL context has been set to the context for drawing
Postcondition:
User application has executed any commands that need to only be executed once per context, per buffer, per frame
Note:
This function is designed to be used when you want to do something only once per frame buffer (i.e. once for left buffer, once for right buffer)
Ex: glClear's need to be done in this method

Reimplemented in vrj::GlProcAppWrapper.

Definition at line 150 of file GlApp.h.

00151    {;}

virtual void vrj::GlApp::pipePreDraw   [inline, virtual]
 

Function that is called at the beginning of the drawing of each pipe.

Precondition:
The library is preparing to render all windows on a given pipe.
Postcondition:
Any pre-pipe user calls have been done.
Note:
Currently the OpenGL context is not set when this function is called.
This is a TEST function. USE AT YOUR OWN RISK!!!

Reimplemented in vrj::OsgApp.

Definition at line 160 of file GlApp.h.

00161    {;}

virtual DrawManager* vrj::GlApp::getDrawManager   [inline, virtual]
 

Get the DrawManager to use.

Returns the OpenGL Draw Manager.

Implements vrj::App.

Definition at line 171 of file GlApp.h.

Referenced by vrj::OsgApp::draw, and vrj::OpenSGApp::draw.

00172    { return GlDrawManager::instance(); }


The documentation for this class was generated from the following file:
Generated on Sun May 2 15:11:08 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002