lobot::GLCanvas Class Reference

An encapsulation of window-viewport primitives for 2D graphics with OpenGL. More...

#include <Robots/LoBot/ui/LoGLCanvas.H>

List of all members.

Classes

class  Params

Public Member Functions

 GLCanvas ()
 Initialization.
void set_viewport (int left, int right, int bottom, int top)
void get_viewport (int *x, int *y, int *width, int *height)
 Retrieve the current GL viewport in effect.
void screen_to_world (int screen_x, int screen_y, double *world_x, double *world_y)
 Convert screen coordinates to world coordinates.
void zoom_to (float zoom_level)
void zoom_by (float delta)
 Zoom the scene by the specified amount.
float zoom_level () const
 Return the current zoom level.
void pan (float dx, float dy)
 Pan the scene by the specified amount.
void reset_zoom_pan ()
 Reset the zoom and pan parameters.
 ~GLCanvas ()
 Clean-up.

void set_window (float left, float right, float bottom, float top)
 This method sets up the world coordinate system.
void set_window (const float window[])



enum  { LEFT, RIGHT, BOTTOM, TOP }

Detailed Description

An encapsulation of window-viewport primitives for 2D graphics with OpenGL.

This class implements some window and viewport operations for doing 2D graphics with OpenGL. Supported operations include zoom and pan.

Definition at line 69 of file LoGLCanvas.H.


Member Enumeration Documentation

anonymous enum

The main purpose of this canvas class is to encapsulate the window and viewport transformations for 2D graphics. These member variables take care of holding the current values of these parameters.

Definition at line 76 of file LoGLCanvas.H.


Constructor & Destructor Documentation

lobot::GLCanvas::GLCanvas (  ) 

Initialization.

Definition at line 90 of file LoGLCanvas.C.

lobot::GLCanvas::~GLCanvas (  ) 

Clean-up.

Definition at line 238 of file LoGLCanvas.C.


Member Function Documentation

void lobot::GLCanvas::get_viewport ( int *  x,
int *  y,
int *  width,
int *  height 
)

Retrieve the current GL viewport in effect.

Definition at line 154 of file LoGLCanvas.C.

void lobot::GLCanvas::pan ( float  dx,
float  dy 
)

Pan the scene by the specified amount.

Definition at line 219 of file LoGLCanvas.C.

References set_window().

Referenced by reset_zoom_pan().

void lobot::GLCanvas::reset_zoom_pan (  ) 

Reset the zoom and pan parameters.

Definition at line 229 of file LoGLCanvas.C.

References pan(), and zoom_to().

void lobot::GLCanvas::screen_to_world ( int  screen_x,
int  screen_y,
double *  world_x,
double *  world_y 
)

Convert screen coordinates to world coordinates.

Definition at line 166 of file LoGLCanvas.C.

void lobot::GLCanvas::set_viewport ( int  left,
int  right,
int  bottom,
int  top 
)

This method sets up the graphics viewport with an aspect ratio matching that of the world coordinate system.

Definition at line 123 of file LoGLCanvas.C.

References R.

void lobot::GLCanvas::set_window ( float  left,
float  right,
float  bottom,
float  top 
)

This method sets up the world coordinate system.

Definition at line 107 of file LoGLCanvas.C.

Referenced by pan(), and zoom_to().

void lobot::GLCanvas::zoom_by ( float  delta  )  [inline]

Zoom the scene by the specified amount.

Definition at line 115 of file LoGLCanvas.H.

References zoom_to().

float lobot::GLCanvas::zoom_level (  )  const [inline]

Return the current zoom level.

Definition at line 118 of file LoGLCanvas.H.

void lobot::GLCanvas::zoom_to ( float  zoom_level  ) 

Zoom the scene contained within the canvas to the specified zoom level.

Definition at line 187 of file LoGLCanvas.C.

References abs(), and set_window().

Referenced by reset_zoom_pan(), and zoom_by().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:44:36 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3