GLWidget Class Reference

GLWidget serves as a further abstraction of OpenGL from QGLWidget. More...

#include <GLWidget.h>

Inherited by BuildGLWidget, ModelGLWidget, and PieceGLWidget.

Inheritance diagram for GLWidget:

Inheritance graph
Collaboration diagram for GLWidget:

Collaboration graph
List of all members.

Public Types

enum  EViewState { Ortho, Perspective }
enum  EMouseAction { Rotate, Translate, Scale }
enum  EAxis {
  Xaxis, Yaxis, Zaxis, XYaxis,
  XZaxis, YZaxis
enum  ETransformType { WorldSpace, ObjectSpace }

Public Slots

void rotateTimeout ()
void resetState ()
void setContinuous (bool val)
void setViewFrustrum (QAction *act)
void setViewFrustrum (GLWidget::EViewState newState)
void setAction (QAction *act)
void setAxis (QAction *act)
void setSpace (QAction *act)
void setCullFace (bool b)
virtual void updateView (int hint)
void doBindTexture (int index, QImage img)
void doUpdateTexture (int index, QImage img)
void rotate (EAxis axis, int x, int y)
void zoom (int v)
void setUsingLight (bool use)
Coord3df lightPos ()
void setLightPos (const Coord3df &c)
void setLightColor (const Coord3df &c)
void reLight ()


void rotated (GLWidget::EAxis axis, int x, int y)
void callReset ()
void zoomChanged (int v)

Public Member Functions

 GLWidget (QWidget *parent=NULL, QGLWidget *sharefrom=NULL)
 the GLWidget constructor.
virtual ~GLWidget ()
bool isUsingLight ()
EViewState currentViewState () const
EMouseAction currentMouseAction () const
EAxis currentAxis () const
ETransformType currentTransformType () const

Public Attributes

QList< int > m_textures

Protected Member Functions

virtual void drawTargets (bool inChoise)
 this is a call back to whoever subclasses this widget and calls DoChoise the default implementation does nothing.
int DoChoise (int chX, int chY)
 perform actual selection of target.
void DoReset ()
void setNewMinMax (const Coord3df &min, const Coord3df &max, bool scale)
void mglPrint (const QString &str)
virtual void myPaintGL ()
virtual void initializeGL ()
virtual void resizeGL (int width, int height)
virtual void mousePressEvent (QMouseEvent *event)
virtual void mouseReleaseEvent (QMouseEvent *event)
virtual void mouseMoveEvent (QMouseEvent *event)
virtual void wheelEvent (QWheelEvent *event)
double getScrDiv () const

Protected Attributes

const int m_minScaleReset
bool m_bBackFaceCulling
bool m_bContinuous
int m_nRotSens
int m_nScaleSens
int m_nTransSens
Coord3df aqmin
Coord3df aqmax
QPoint m_lastPos
EViewState m_viewState
EMouseAction m_mouseAct
EAxis m_axis
ETransformType m_transformType
int m_zoomVal
bool m_fUseLight
Coord3df m_lightPos
Coord3df m_lightColor
float m_lightAmbient
float m_lightDiffuse
float m_lightSpecular
bool m_bSkewReset

Private Member Functions

virtual void paintGL ()
void callDrawTargets ()
bool SetupViewingFrustum (void)
bool SetupViewingOrthoConstAspect (void)
void reCalcProj (bool fFromScratch=true)
void reCalcLight ()
void ActMouseMove (EMouseAction action, int dx, int dy)
void translate (int xValue, int yValue)
void scale (int xValue, int yValue)
void BuildFont ()
 Build Our Bitmap Font.
void KillFont ()
 Delete The Font.

Private Attributes

int m_nXDelt
int m_nYDelt
bool m_bTimerMode
QTimer * m_timer
int m_fontBase
int m_cxClient
 hold the windows width
int m_cyClient
 hold the windows height
double m_AspectRatio
 hold the fixed Aspect Ration
double scrScale
double realScale
double m_osf

Detailed Description

GLWidget serves as a further abstraction of OpenGL from QGLWidget.

It implements several key functionalities all the QGLWidgets I'm using share in common. these unctionalities are:

Member Enumeration Documentation





Constructor & Destructor Documentation

GLWidget::GLWidget ( QWidget *  parent = NULL,
QGLWidget *  sharefrom = NULL 

the GLWidget constructor.

alot of default values are set here. if a derived subclass wishes for a different setting he may alter them in its constructor.

virtual GLWidget::~GLWidget (  )  [inline, virtual]

Member Function Documentation

bool GLWidget::isUsingLight (  )  [inline]

EViewState GLWidget::currentViewState (  )  const [inline]

EMouseAction GLWidget::currentMouseAction (  )  const [inline]

EAxis GLWidget::currentAxis (  )  const [inline]

ETransformType GLWidget::currentTransformType (  )  const [inline]

void GLWidget::rotateTimeout (  )  [slot]

void GLWidget::resetState (  )  [inline, slot]

void GLWidget::setContinuous ( bool  val  )  [slot]

void GLWidget::setViewFrustrum ( QAction *  act  )  [slot]

void GLWidget::setViewFrustrum ( GLWidget::EViewState  newState  )  [slot]

void GLWidget::setAction ( QAction *  act  )  [slot]

void GLWidget::setAxis ( QAction *  act  )  [slot]

void GLWidget::setSpace ( QAction *  act  )  [slot]

void GLWidget::setCullFace ( bool  b  )  [slot]

virtual void GLWidget::updateView ( int  hint  )  [inline, virtual, slot]

Reimplemented in BuildGLWidget, and ModelGLWidget.

void GLWidget::doBindTexture ( int  index,
QImage  img 
) [slot]

void GLWidget::doUpdateTexture ( int  index,
QImage  img 
) [slot]

void GLWidget::rotate ( EAxis  axis,
int  x,
int  y 
) [slot]

void GLWidget::zoom ( int  v  )  [slot]

void GLWidget::setUsingLight ( bool  use  )  [slot]

Coord3df GLWidget::lightPos (  )  [inline, slot]

void GLWidget::setLightPos ( const Coord3df c  )  [slot]

void GLWidget::setLightColor ( const Coord3df c  )  [slot]

void GLWidget::reLight (  )  [inline, slot]

void GLWidget::rotated ( GLWidget::EAxis  axis,
int  x,
int  y 
) [signal]

void GLWidget::callReset (  )  [signal]

void GLWidget::zoomChanged ( int  v  )  [signal]

virtual void GLWidget::drawTargets ( bool  inChoise  )  [inline, protected, virtual]

this is a call back to whoever subclasses this widget and calls DoChoise the default implementation does nothing.

  • inChoise a helper argument for user specified functionality. GLWidget always calls this method with inChoise == true. if the user calls this function on his own he may want to do so with inChoise == false and do slightly differnt things, such us use more color and textures.

Reimplemented in BuildGLWidget, and ModelGLWidget.

int GLWidget::DoChoise ( int  chX,
int  chY 
) [protected]

perform actual selection of target.

void GLWidget::DoReset (  )  [protected]

void GLWidget::setNewMinMax ( const Coord3df min,
const Coord3df max,
bool  scale 
) [protected]

void GLWidget::mglPrint ( const QString &  str  )  [protected]

void GLWidget::myPaintGL (  )  [protected, virtual]

Reimplemented in BuildGLWidget, ModelGLWidget, and PieceGLWidget.

void GLWidget::initializeGL (  )  [protected, virtual]

void GLWidget::resizeGL ( int  width,
int  height 
) [protected, virtual]

void GLWidget::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual]

Reimplemented in ModelGLWidget.

void GLWidget::mouseReleaseEvent ( QMouseEvent *  event  )  [protected, virtual]

Reimplemented in ModelGLWidget.

void GLWidget::mouseMoveEvent ( QMouseEvent *  event  )  [protected, virtual]

Reimplemented in BuildGLWidget, ModelGLWidget, and PieceGLWidget.

void GLWidget::wheelEvent ( QWheelEvent *  event  )  [protected, virtual]

double GLWidget::getScrDiv (  )  const [inline, protected]

void GLWidget::paintGL (  )  [private, virtual]

void GLWidget::callDrawTargets (  )  [private]

bool GLWidget::SetupViewingFrustum ( void   )  [private]

bool GLWidget::SetupViewingOrthoConstAspect ( void   )  [private]

void GLWidget::reCalcProj ( bool  fFromScratch = true  )  [private]

void GLWidget::reCalcLight (  )  [private]

void GLWidget::ActMouseMove ( EMouseAction  action,
int  dx,
int  dy 
) [private]

void GLWidget::translate ( int  xValue,
int  yValue 
) [private]

void GLWidget::scale ( int  xValue,
int  yValue 
) [private]

void GLWidget::BuildFont (  )  [private]

Build Our Bitmap Font.

void GLWidget::KillFont (  )  [private]

Delete The Font.

Member Data Documentation

const int GLWidget::m_minScaleReset [protected]

bool GLWidget::m_bBackFaceCulling [protected]

bool GLWidget::m_bContinuous [protected]

int GLWidget::m_nRotSens [protected]

int GLWidget::m_nScaleSens [protected]

int GLWidget::m_nTransSens [protected]

QPoint GLWidget::m_lastPos [protected]

EAxis GLWidget::m_axis [protected]

int GLWidget::m_zoomVal [protected]

bool GLWidget::m_fUseLight [protected]

float GLWidget::m_lightAmbient [protected]

float GLWidget::m_lightDiffuse [protected]

float GLWidget::m_lightSpecular [protected]

bool GLWidget::m_bSkewReset [protected]

int GLWidget::m_nXDelt [private]

int GLWidget::m_nYDelt [private]

bool GLWidget::m_bTimerMode [private]

QTimer* GLWidget::m_timer [private]

int GLWidget::m_fontBase [private]

int GLWidget::m_cxClient [private]

hold the windows width

int GLWidget::m_cyClient [private]

hold the windows height

double GLWidget::m_AspectRatio [private]

hold the fixed Aspect Ration

double GLWidget::scrScale [private]

double GLWidget::realScale [private]

double GLWidget::m_osf [private]

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