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

GLScreenViewer Class Reference

Inherits QGLViewer to provide a viewer that is more suited to simply displaying the contents of a scene directly. More...

#include <glscreenviewer.h>

Inheritance diagram for GLScreenViewer:

QGLViewer List of all members.

Public Member Functions

 GLScreenViewer (const GLScene *const s, QWidget *parent)
 GLScreenViewer (const GLScene *const s, const QGLFormat &format, QWidget *parent)
bool willReinit () const
void setReinitRequired (bool required)
GLenum matrixMode () const
const GLdouble * projectionMatrix () const
const GLdouble * modelviewMatrix () const
bool autoGLClearEnabled () const
bool autoGLFlushEnabled () const
bool aspectRatioKept () const
void setAutoGLClearEnabled (bool enable)
void setAutoGLFlushEnabled (bool enable)
void setKeepAspectRatio (bool enable)

Protected Slots

virtual void setGeometry (int x, int y, int w, int h)
virtual void setGeometry (const QRect &r)
virtual void mousePressEvent (QMouseEvent *)
virtual void mouseDoubleClickEvent (QMouseEvent *)
virtual void mouseReleaseEvent (QMouseEvent *)
virtual void mouseMoveEvent (QMouseEvent *)
virtual void wheelEvent (QWheelEvent *)
virtual void keyPressEvent (QKeyEvent *)

Protected Member Functions

void sharedInit ()
virtual void init ()
virtual void draw ()
virtual void preDraw ()
virtual void postDraw ()

Private Attributes

const GLScene *const myScene
GLenum myMatrixMode
GLdouble myProjectionMatrix [16]
GLdouble myModelviewMatrix [16]
bool reinitRequired
bool keepAspectRatio
bool autoGLClear
bool autoGLFlush

Detailed Description

Inherits QGLViewer to provide a viewer that is more suited to simply displaying the contents of a scene directly.

This class is used also to feed information to Glitch and any GLWorldViewer, regarding the current matrix mode, and current model view and projection matrix values. Where by current, we mean the state immediately after the scene is drawn.

Note: Display lists are NOT used to cache the initialization and display commands, as they would enfore too many limitations. For example, many OpenGL commands cannot be placed in display lists, such as those that pass parameters by reference (as they may be out of scope). It would also prevent the user from working with display lists themselves.


Constructor & Destructor Documentation

GLScreenViewer::GLScreenViewer const GLScene *const  s,
QWidget *  parent
 

Constructor.

GLScreenViewer::GLScreenViewer const GLScene *const  s,
const QGLFormat &  format,
QWidget *  parent
 

Constructor.

This constructor takes a QGLFormat parameter, so that special format options such as double buffering can be enabled and disabled.


Member Function Documentation

bool GLScreenViewer::aspectRatioKept  )  const [inline]
 

bool GLScreenViewer::autoGLClearEnabled  )  const [inline]
 

bool GLScreenViewer::autoGLFlushEnabled  )  const [inline]
 

void GLScreenViewer::draw  )  [protected, virtual]
 

Execute the OpenGL scene, in its purist form.

We also get and store the post-scene matrix mode and the model view and projection matrix values, which will be used by Glitch and GLWorldViewer. Note: This method will perfrom:

 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ACCUM_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ) 
if and only if autoGLClear == true. Note that this will be called after any initialization commands and before any display ones.

Note: If reinitRequired = true, then this will restore the OpenGL state, delete any existing display lists and make a few other cleanups so that it can then (re-)initialize the scene, by executing the scene's initializetion commands.

Reimplemented from QGLViewer.

void GLScreenViewer::init  )  [protected, virtual]
 

Initialize OpenGL for the context.

This method is called by QGLViewer::initializeGL().

The main reason that this has been implemented, is to undo the non-standard modifications that QGLViewer::initializeGL() makes to the OpenGL initial state.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::keyPressEvent QKeyEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable keyboard interaction. (Exception: mouse button modifiers)

Reimplemented from QGLViewer.

GLenum GLScreenViewer::matrixMode  )  const [inline]
 

const GLdouble* GLScreenViewer::modelviewMatrix  )  const [inline]
 

virtual void GLScreenViewer::mouseDoubleClickEvent QMouseEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable mouse interaction.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::mouseMoveEvent QMouseEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable mouse interaction.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::mousePressEvent QMouseEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable mouse interaction.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::mouseReleaseEvent QMouseEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable mouse interaction.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::postDraw  )  [inline, protected, virtual]
 

Ban QGLViewer from interfering with the post-draw OpenGL state. We don't need things like the axis, grid or visual hints to be drawn.

Reimplemented from QGLViewer.

virtual void GLScreenViewer::preDraw  )  [inline, protected, virtual]
 

Ban QGLViewer from interfering with the pre-draw OpenGL state. We will look after things like glClear and the matrix modes and values.

Reimplemented from QGLViewer.

const GLdouble* GLScreenViewer::projectionMatrix  )  const [inline]
 

void GLScreenViewer::setAutoGLClearEnabled bool  enable  )  [inline]
 

void GLScreenViewer::setAutoGLFlushEnabled bool  enable  )  [inline]
 

void GLScreenViewer::setGeometry const QRect &  r  )  [protected, virtual, slot]
 

This method looks after actually resizing this widget within its parent, so that it keeps a perfect 1:1 width-to-height aspect ratio.

This is called by both GLScreenViewer::setKeepAspectRatio() and just as importantly Qt. Qt wil call this when the parent is resized, hence asking for this widget to update its size.

void GLScreenViewer::setGeometry int  x,
int  y,
int  w,
int  h
[protected, virtual, slot]
 

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This corresponds to setGeometry( QRect(x, y, w, h) )

void GLScreenViewer::setKeepAspectRatio bool  enable  ) 
 

Request that this widget resizes itself within its parent, so that it keeps a perfect 1:1 width-to-height aspect ratio.

Note: This method requires that the parent for this widget is valid (i.e. != NULL).

void GLScreenViewer::setReinitRequired bool  required  )  [inline]
 

Tell the viewer that when it updates again, that it must re-init itself.

void GLScreenViewer::sharedInit  )  [protected]
 

This method is used by the constructors to perform tasks that are common to all of them.

virtual void GLScreenViewer::wheelEvent QWheelEvent *   )  [inline, protected, virtual, slot]
 

Reimplemented as {}, as to disable mouse interaction.

Reimplemented from QGLViewer.

bool GLScreenViewer::willReinit  )  const [inline]
 

This tells us if the viewer will re-init itself on the next update.


Member Data Documentation

bool GLScreenViewer::autoGLClear [private]
 

bool GLScreenViewer::autoGLFlush [private]
 

bool GLScreenViewer::keepAspectRatio [private]
 

GLenum GLScreenViewer::myMatrixMode [private]
 

GLdouble GLScreenViewer::myModelviewMatrix[16] [private]
 

GLdouble GLScreenViewer::myProjectionMatrix[16] [private]
 

const GLScene* const GLScreenViewer::myScene [private]
 

bool GLScreenViewer::reinitRequired [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