OpenGLCanvas Class Reference

Provides an OpenGL rendering view. More...

#include <OpenGLCanvas.h>

Inheritance diagram for OpenGLCanvas:

Canvas

List of all members.

Public Slots

Main usage interface
void setDrawMode (int style)
virtual void redraw ()

Public Member Functions

virtual void init ()
virtual bool supportsOpenGL () const
virtual QWidget * getQWidget ()
Constructors
 OpenGLCanvas (bool defaultInteractionListeners, Gui *gui=NULL, unsigned width=(480), unsigned height=(480))
 OpenGLCanvas (Gui *gui=NULL, unsigned width=(480), unsigned height=(480))
 Constructs an OpenGLCanvas with default interaction listeners (Maya-style camera interactions).
virtual ~OpenGLCanvas ()
Saving
bool save (const char *fileName)
OpenGL light utility methods (lights specified by integer id)
void lightOn (int light)
 Turns the light on.
void lightOff (int light)
 Turns the light off.
void lightPos (int light, float x, float y, float z)
void lightColor (int light, float r, float g, float b)
 Specifies the color of the light.
void lightFunc (int light, float a, float b, float c)
 Specifies the function of the light.

Protected Member Functions

Overridden from QWidget
virtual void mousePressEvent (QMouseEvent *)
virtual void mouseReleaseEvent (QMouseEvent *)
virtual void mouseMoveEvent (QMouseEvent *)
virtual void keyPressEvent (QKeyEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual QSize sizeHint () const
virtual QSize minimumSize () const
virtual QSize maximumSize () const
virtual void initializeGL ()
virtual void paintEvent (QPaintEvent *e)
void resizeGL (int width, int height)

Protected Attributes

int m_drawMode


Detailed Description

Provides an OpenGL rendering view.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008

Definition at line 26 of file OpenGLCanvas.h.


Constructor & Destructor Documentation

OpenGLCanvas::OpenGLCanvas ( bool  defaultInteractionListeners,
Gui gui = NULL,
unsigned  width = (480),
unsigned  height = (480) 
)

Parameters:
defaultInteractionListeners if true will enable the basic, built-in, Maya-style user interactions via CTRL + mouse

Definition at line 17 of file OpenGLCanvas.cpp.

OpenGLCanvas::OpenGLCanvas ( Gui gui = NULL,
unsigned  width = (480),
unsigned  height = (480) 
)

Constructs an OpenGLCanvas with default interaction listeners (Maya-style camera interactions).

Definition at line 24 of file OpenGLCanvas.cpp.

OpenGLCanvas::~OpenGLCanvas (  )  [virtual]

Definition at line 30 of file OpenGLCanvas.cpp.


Member Function Documentation

bool OpenGLCanvas::save ( const char *  fileName  )  [virtual]

Attempts to saver this canvas' image to the specified file

Returns:
whether or not the save was successful

Implements Canvas.

Definition at line 44 of file OpenGLCanvas.cpp.

void OpenGLCanvas::lightOn ( int  light  ) 

Turns the light on.

Definition at line 61 of file OpenGLCanvas.cpp.

void OpenGLCanvas::lightOff ( int  light  ) 

Turns the light off.

Definition at line 66 of file OpenGLCanvas.cpp.

void OpenGLCanvas::lightPos ( int  light,
float  x,
float  y,
float  z 
)

Specifies the position of the light

Note:
Assumes current matrixMode is GL_MODELVIEW

Definition at line 71 of file OpenGLCanvas.cpp.

void OpenGLCanvas::lightColor ( int  light,
float  r,
float  g,
float  b 
)

Specifies the color of the light.

Definition at line 81 of file OpenGLCanvas.cpp.

void OpenGLCanvas::lightFunc ( int  light,
float  a,
float  b,
float  c 
)

Specifies the function of the light.

Definition at line 89 of file OpenGLCanvas.cpp.

void OpenGLCanvas::init (  )  [virtual]

Reimplemented from Canvas.

Definition at line 33 of file OpenGLCanvas.cpp.

bool OpenGLCanvas::supportsOpenGL (  )  const [virtual]

Returns:
true iff this Canvas supports OpenGL
Note:
Gui assumes that if a Canvas supports OpenGL, it also derives from QGLWidget
See also:
also OpenGLCanvas

Implements Canvas.

Definition at line 98 of file OpenGLCanvas.cpp.

virtual QWidget* OpenGLCanvas::getQWidget (  )  [inline, virtual]

Returns:
the QWidget associated with this Canvas

Implements Canvas.

Definition at line 86 of file OpenGLCanvas.h.

void OpenGLCanvas::setDrawMode ( int  style  )  [slot]

Definition at line 267 of file OpenGLCanvas.cpp.

void OpenGLCanvas::redraw (  )  [virtual, slot]

Implements Canvas.

Definition at line 158 of file OpenGLCanvas.cpp.

void OpenGLCanvas::mousePressEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 103 of file OpenGLCanvas.cpp.

void OpenGLCanvas::mouseReleaseEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 107 of file OpenGLCanvas.cpp.

void OpenGLCanvas::mouseMoveEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 111 of file OpenGLCanvas.cpp.

void OpenGLCanvas::keyPressEvent ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 115 of file OpenGLCanvas.cpp.

void OpenGLCanvas::keyReleaseEvent ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 119 of file OpenGLCanvas.cpp.

QSize OpenGLCanvas::sizeHint (  )  const [protected, virtual]

Definition at line 124 of file OpenGLCanvas.cpp.

QSize OpenGLCanvas::minimumSize (  )  const [protected, virtual]

Definition at line 128 of file OpenGLCanvas.cpp.

QSize OpenGLCanvas::maximumSize (  )  const [protected, virtual]

Definition at line 132 of file OpenGLCanvas.cpp.

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

Definition at line 137 of file OpenGLCanvas.cpp.

void OpenGLCanvas::paintEvent ( QPaintEvent *  e  )  [protected, virtual]

Definition at line 162 of file OpenGLCanvas.cpp.

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

Definition at line 263 of file OpenGLCanvas.cpp.


Member Data Documentation

int OpenGLCanvas::m_drawMode [protected]

Definition at line 121 of file OpenGLCanvas.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6