My Project
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GlutWindow2d Class Referenceabstract

#include <GlutWindow2d.h>

Inheritance diagram for GlutWindow2d:
GlutWindow ParticlePlot

Public Member Functions

 GlutWindow2d (const char *title, int width=800, int height=800)
 
virtual ~GlutWindow2d ()
 
virtual void reshape (int w, int h)
 
virtual void display ()
 
virtual void draw ()=0
 
virtual void processNormalKeys (unsigned char key, int x, int y)
 
virtual void processSpecialKeys (int key, int x, int y)
 
virtual void mouse (int button, int state, int x, int y)
 
virtual void mouseMotion (int x, int y)
 
virtual void positionCamera ()
 
- Public Member Functions inherited from GlutWindow
 GlutWindow (const char *title, int width=800, int height=800)
 
virtual ~GlutWindow ()
 
int getWidth () const
 
int getHeight () const
 
int getButton () const
 
virtual void idle ()
 
virtual void run ()
 
void drawText (const char *txt, float x, float y, float r, float g, float b, void *font)
 

Protected Member Functions

virtual void init ()
 
void drawZoomCircle ()
 
void setProjectiveSettings ()
 
void drawText2d (const char *txt, float x, float y, float r, float g, float b, void *font)
 
- Protected Member Functions inherited from GlutWindow
void initFunctionPtrs ()
 
double degToRad (const double &angle)
 

Protected Attributes

double zoomFactor
 
double mouseStartZoom
 
double panXOffset
 
double panYOffset
 
double mousePanXOffset
 
double mousePanYOffset
 
bool drawZoomCircleFlag
 
double zoomDrawRadius
 
- Protected Attributes inherited from GlutWindow
int windowID
 
char * myTitle
 
int windowHeight
 
int windowWidth
 
int buttonDown
 
int mouseStartX
 
int mouseStartY
 
bool windowLaunched
 

Additional Inherited Members

- Static Protected Member Functions inherited from GlutWindow
static void _reshape (int w, int h)
 
static void _idle ()
 
static void _display ()
 
static void _mouse (int button, int state, int x, int y)
 
static void _processNormalKeys (unsigned char key, int x, int y)
 
static void _processSpecialKeys (int key, int x, int y)
 
static void _mouseMotion (int x, int y)
 
- Static Protected Attributes inherited from GlutWindow
static GlutWindowmyWindow
 

Constructor & Destructor Documentation

GlutWindow2d::GlutWindow2d ( const char *  title,
int  width = 800,
int  height = 800 
)

Basic constructor

GlutWindow2d::~GlutWindow2d ( )
virtual

Basic destructor

Member Function Documentation

void GlutWindow2d::display ( )
virtual

This will setup the camera and then call draw().

Implements GlutWindow.

virtual void GlutWindow2d::draw ( )
pure virtual

Override this function to draw the scene. This function is called from the display function automatically.

Implemented in ParticlePlot.

void GlutWindow2d::drawText2d ( const char *  txt,
float  x,
float  y,
float  r,
float  g,
float  b,
void *  font 
)
protected

This will draw the given string to the screen at the location given by x,y- (relative to the current window properties). the color defaults to a gray

void GlutWindow2d::drawZoomCircle ( )
protected

Draws the zoom circle when changing the zoom factor

void GlutWindow2d::init ( )
protectedvirtual

Setups and Initializes the window

Implements GlutWindow.

void GlutWindow2d::mouse ( int  button,
int  state,
int  x,
int  y 
)
virtual

This is used in conjunction with mouseMotion to provide the camera movement.

Parameters
buttonThe button that was pressed
xThe x location of the cursor when the button was pressed
yThe y location of the cursor when the button was pressed

This is used in conjunction with mouseMotion to provide the camera movement. Moving the mouse with the left button down rotates the camera around a fixed point (specified by viewX, viewY, viewZ). Moving the mouse with the right button down zooms the camera in and out

If you would like to perform other operations with the mouse, override this function, you may want to consider calling Glut_Window::mouse() in that routine to maintain the mouse interface.

Parameters
buttonThe button that was pressed
xThe x location of the cursor when the button was pressed
yThe y location of the cursor when the button was pressed

Reimplemented from GlutWindow.

void GlutWindow2d::mouseMotion ( int  x,
int  y 
)
virtual

This routine is called whenever a mouse movement event has occured.

Parameters
xThe x location of the mouse
yThe y location of the mouse

This routine is called whenever a mouse movement event has occured. If you are overriding it, consider calling Glut_Window::mouse_motion() in your descendant classes, to maintain the mouse interface

Parameters
xThe x location of the mouse
yThe y location of the mouse

Reimplemented from GlutWindow.

void GlutWindow2d::positionCamera ( )
virtual

Overide this function to change the location from which the scene is rendered. It currently uses information from the mouse and the special keyboard keys to set its direction

Reimplemented from GlutWindow.

void GlutWindow2d::processNormalKeys ( unsigned char  key,
int  x,
int  y 
)
virtual

This function is called when an ascii key is pressed.

Parameters
keyThe key that was pressed
xThe x location of the cursor when the key was pressed
yThe y location of the cursor when the key was pressed

Reimplemented from GlutWindow.

Reimplemented in ParticlePlot.

void GlutWindow2d::processSpecialKeys ( int  key,
int  x,
int  y 
)
virtual

This function is used to perform actions when one of the non-ascii keys are presed.

Parameters
keyThe key that was pressed
xThe x location of the cursor when the key was pressed
yThe y location of the cursor when the key was pressed

This function is used to perform actions when one of the non-ascii keys are presed. In the base class, the arrow keys are used to move the center of the field of view around in the plane, while PAGE_UP & PAGE_DOWN are used to change the Z value of the center of view.

If you would like to perform other options with the special keys, then when overriding this function, you may want to consider calling GlutWindow2d::processSpecialKeys(key, x, y) in the overridden function to maintain the same base functionality.

Parameters
keyThe key that was pressed
xThe x location of the cursor when the key was pressed
yThe y location of the cursor when the key was pressed

Reimplemented from GlutWindow.

void GlutWindow2d::reshape ( int  w,
int  h 
)
virtual

This performs generic graphics matrix setup operations, and will be called if the user resizes the window

Parameters
wWidth of the window
hHeight of the window

Implements GlutWindow.

void GlutWindow2d::setProjectiveSettings ( )
protected

Set the projection parameters

Member Data Documentation

bool GlutWindow2d::drawZoomCircleFlag
protected

Whether or not to draw the zoom circle

double GlutWindow2d::mousePanXOffset
protected

Remember where the pan x offset started from when the mouse is clicked

double GlutWindow2d::mousePanYOffset
protected

Remember where the pan y offset started from when the mouse is clicked

double GlutWindow2d::mouseStartZoom
protected

Remember where the zoom started from

double GlutWindow2d::panXOffset
protected

The value for the panning in the x direction

double GlutWindow2d::panYOffset
protected

The value for the panning in the y direction

double GlutWindow2d::zoomDrawRadius
protected

The zoom radius for drawing purposes

double GlutWindow2d::zoomFactor
protected

Factor to adjust the zoom


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