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

GLScene Class Reference

Encapsulates an OpenGL scene. More...

#include <glscene.h>

List of all members.

Public Member Functions

 GLScene ()
void setInitCmds (QPtrList< CmdInstance > *cmds)
void setDisplayCmds (QPtrList< CmdInstance > *cmds)
void execInitCmds (bool disableProjectionMods=false, bool disableViewports=false, bool origStateAsIdentity=false) const
void execDisplayCmds (bool disableProjectionMods=false, bool disableViewports=false, bool origStateAsIdentity=false) const
void setStepModeEnabled (bool enable)
bool stepModeIsEnabled () const
void setStepModePos (uint pos)
uint getStepModePos () const
bool autoGLEndEnabled () const
void setAutoGLEndEnabled (bool enable)

Private Member Functions

void execCmdIntanceList (QPtrList< CmdInstance > *cmdInstances, bool useStepper, bool origStateAsIdentity, bool disableProjectionMods, bool disableViewports) const

Private Attributes

QPtrList< CmdInstance > * initCmds
QPtrList< CmdInstance > * displayCmds
bool stepMode
uint stepModePos
bool autoGLEnd


Detailed Description

Encapsulates an OpenGL scene.

A single scene instance is designed to be shared upon multiple viewers, such as GLWorldViewer and GLScreenViewer.

The scene is drawn using a list of initialzation commmands and a list of display commands, both of which need to be executed.

It also provides a facility for stepping through commands - like a debug mode.


Constructor & Destructor Documentation

GLScene::GLScene  ) 
 

>Constructor.

This will initialize the object's members to the following

  • initCmds = NULL
  • displayCmds = NULL
  • stepMode = false
  • stepModePos = 0
  • autoGLEnd = true


Member Function Documentation

bool GLScene::autoGLEndEnabled  )  const [inline]
 

void GLScene::execCmdIntanceList QPtrList< CmdInstance > *  cmdInstances,
bool  useStepper,
bool  origStateAsIdentity,
bool  disableProjectionMods,
bool  disableViewports
const [private]
 

Execute the commands from one of the scene's command instance lists, which is either initialization or display, set by cmdInstances.

The useStepper parameter specifies whether or not the stepper position affects which commands to execute. This should only be used for the display commands, not the initialization ones.

The origStateAsIdentity indicates that whenever a glLoadIdentity() call is made, then the actual matrix that is to be loaded is the original one, before any commands are / were executed, for either the model view or project matrices.
This is useful in the case of a world viewer, where the whole scene of commands are to be transfromed with respect to a camera. In this case, when a glLoadIdentity() call is made, we still want the camera to affect the scene, so we must use the post camera-transformed matrices as our idenities.

The parameter disableProjectionMods, it allows you to prevent modifications to the projection matrix. This is useful for implementing a viewer that DRAWS the projection, rather that actually executing it.

As for the parameter disableViewports, it allows you to prevent viewports to be created. Again, this is useful for implementing a viewer that does not support them, such as a global world viewer.

Note: If cmdInstances = 0, then this method will return without doing anything.

Note: To fulfill the requirements of this second parameter (when it is enabled), each command instance is checked to see if its name is an exact match to the string GL_VIEWPORT_NAME ("glViewport"). Obviously if it is, then the command is ignored.

Note: This method PURPOSELY does not save and restore the current matrix, nor OpenGL attributes. This allows information about the final state to be gathered by callers. Hence, when calling this method, you must look after the state YOURSELF.

See also GLScene::setAutoGLEndEnabled

void GLScene::execDisplayCmds bool  disableProjectionMods = false,
bool  disableViewports = false,
bool  origStateAsIdentity = false
const
 

Execute the display commands part of the scene.

Please see GLScene::execCmdIntanceList() for details.

void GLScene::execInitCmds bool  disableProjectionMods = false,
bool  disableViewports = false,
bool  origStateAsIdentity = false
const
 

Execute the initialization commands part of the scene.

Please see GLScene::execCmdIntanceList() for details.

uint GLScene::getStepModePos  )  const [inline]
 

void GLScene::setAutoGLEndEnabled bool  enable  ) 
 

The automatic glEnd() OpenGL call is needed to keep OpenGL working in the case where glBegin is called but has not been followed through with a glEnd call. This happens for example, when in stepper mode and you have stepped past a glBegin but not yet to its glEnd call yet.

It fixes the display and ALSO the ability to get the matrix values.

Note: This does NOT call GLScene::exec(). That is to be done by the viewer.

void GLScene::setDisplayCmds QPtrList< CmdInstance > *  cmds  )  [inline]
 

void GLScene::setInitCmds QPtrList< CmdInstance > *  cmds  )  [inline]
 

void GLScene::setStepModeEnabled bool  enable  )  [inline]
 

void GLScene::setStepModePos uint  pos  )  [inline]
 

bool GLScene::stepModeIsEnabled  )  const [inline]
 


Member Data Documentation

bool GLScene::autoGLEnd [private]
 

QPtrList<CmdInstance>* GLScene::displayCmds [private]
 

QPtrList<CmdInstance>* GLScene::initCmds [private]
 

bool GLScene::stepMode [private]
 

uint GLScene::stepModePos [private]
 


The documentation for this class was generated from the following files:
Generated on Fri Feb 27 12:01:40 2004 for Glitch by doxygen 1.3.2