CVD::VideoDisplay Class Reference
[GL helper functions and classes.]

#include <videodisplay.h>

List of all members.

Public Member Functions

Display * display ()
 What is my display?
void display_to_video (int dx, int dy, double &vx, double &vy)
void flush ()
 Flushes the output buffer by calling XFlush.
void get_event (XEvent *event)
int get_fd ()
 Returns the connection number for this display.
void locate_display_pointer (int &x, int &y)
void locate_video_pointer (double &x, double &y)
void make_current ()
int pending ()
 How many events are waiting the queue?
void select_events (long event_mask)
void set_title (const std::string &s)
void set_zoom (double left, double top, double right, double bottom, double scale)
void swap_buffers ()
double video_height () const
 What is the height of the local GL co-ordinates displayed?
void video_to_display (double dx, double dy, int &vx, int &vy)
double video_width () const
 What is the width of the local GL co-ordinates displayed?
 VideoDisplay (ImageRef size, double scale=1, int *visualAttr=defAttr)
 VideoDisplay (double left, double top, double right, double bottom, double scale=1, int *visualAttr=defAttr)
Window window ()
 Which is my window?
void zoom_in (double cx, double cy, double factor=2)
void zoom_out (double cx, double cy, double factor=2)
void zoom_reset ()
 Reset the image mapping to that when the VideoDisplay was created.
 ~VideoDisplay ()
 Destructor. This also removes the window from the display.

Private Member Functions

void init (double, double, double, double, double, int *visualAttr)
int operator= (VideoDisplay &copyof)
 VideoDisplay (VideoDisplay &copyof)

Private Attributes

double my_bottom
Colormap my_cmap
Display * my_display
GLXContext my_glx_context
double my_left
double my_orig_bottom
double my_orig_left
double my_orig_right
double my_orig_scale
double my_orig_top
bool my_positive_down
bool my_positive_right
double my_right
double my_scale
double my_top
XVisualInfo * my_visual
Window my_window

Related Functions

(Note that these are not member functions.)



int defAttr []

Detailed Description

A cheap and cheerful GL display window using X and the GLX library. VideoDisplay maintains for you the mapping between your choice of local GL co-ordinates, and image co-ordinates and provides functions for converting between the two. It does not, however, manage any X events, for example resize or redraw events. To develop a more sophisticated display window, you must select which XEvents to monitor using select_events() and then poll using pending() and use get_event() to handle events.

Definition at line 87 of file videodisplay.h.


Constructor & Destructor Documentation

CVD::VideoDisplay::VideoDisplay ( double  left,
double  top,
double  right,
double  bottom,
double  scale = 1,
int *  visualAttr = defAttr 
)

Construct (and display) a display window

Parameters:
left The local GL co-ordinate of the left of the window
top The local GL co-ordinate of the top of the window
right The local GL co-ordinate of the right of the window
bottom The local GL co-ordinate of bottom of the window
scale The number of image pixels per GL unit (default 1:1)
visualAttr The attributes passed to glXChooseVisual
CVD::VideoDisplay::VideoDisplay ( ImageRef  size,
double  scale = 1,
int *  visualAttr = defAttr 
)

Construct (and display) a display window

Parameters:
size The GL co-ordinate window goes from (0,0) to (size.x, size.y)
scale The number of image pixels per GL unit (default 1:1)
visualAttr The attributes passed to glXChooseVisual
CVD::VideoDisplay::~VideoDisplay (  ) 

Destructor. This also removes the window from the display.

CVD::VideoDisplay::VideoDisplay ( VideoDisplay copyof  )  [private]

Member Function Documentation

Display* CVD::VideoDisplay::display (  )  [inline]

What is my display?

Definition at line 185 of file videodisplay.h.

void CVD::VideoDisplay::display_to_video ( int  dx,
int  dy,
double &  vx,
double &  vy 
)

Convert image co-ordinates into local GL co-ordinates

Parameters:
dx The image x co-ordinate to convert
dy The image y co-ordinate to convert
vx The returned local GL x co-ordinate
vy The returned local GL y co-ordinate
void CVD::VideoDisplay::flush (  ) 

Flushes the output buffer by calling XFlush.

void CVD::VideoDisplay::get_event ( XEvent *  event  ) 

Get the next X event from the queue by calling XNextEvent. If the queue is empty, this function blocks until the next event

Parameters:
event The next event
int CVD::VideoDisplay::get_fd (  )  [inline]

Returns the connection number for this display.

Definition at line 115 of file videodisplay.h.

void CVD::VideoDisplay::init ( double  ,
double  ,
double  ,
double  ,
double  ,
int *  visualAttr 
) [private]
void CVD::VideoDisplay::locate_display_pointer ( int &  x,
int &  y 
)

Where is the mouse pointer in the window?

Parameters:
x The x co-ordinate
y The y co-ordinate
void CVD::VideoDisplay::locate_video_pointer ( double &  x,
double &  y 
)

Where is the mouse pointer in local GL co-ordinates?

Parameters:
x The x co-ordinate
y The y co-ordinate
void CVD::VideoDisplay::make_current (  ) 

Make this window the current GL context. If there is more than one GL window being used in your program, this function should be called before drawing to ensure you draw to the correct window.

int CVD::VideoDisplay::operator= ( VideoDisplay copyof  )  [private]
int CVD::VideoDisplay::pending (  ) 

How many events are waiting the queue?

void CVD::VideoDisplay::select_events ( long  event_mask  ) 

Select which X events to handle (by default, nothing is handled)

Parameters:
event_mask ORed list of XEvents to handle
void CVD::VideoDisplay::set_title ( const std::string &  s  ) 

Set the window title.

Parameters:
s The new title
void CVD::VideoDisplay::set_zoom ( double  left,
double  top,
double  right,
double  bottom,
double  scale 
)

Set the desired mapping between local GL and image co-ordinates

Parameters:
left The local GL co-ordinate of the left of the window
top The local GL co-ordinate of the top of the window
right The local GL co-ordinate of the right of the window
bottom The local GL co-ordinate of bottom of the window
scale The number if image pixels per GL unit
void CVD::VideoDisplay::swap_buffers (  ) 

Swap the front and back GL buffers. This calls glXSwapBuffers for the current context.

double CVD::VideoDisplay::video_height (  )  const [inline]

What is the height of the local GL co-ordinates displayed?

Definition at line 161 of file videodisplay.h.

void CVD::VideoDisplay::video_to_display ( double  dx,
double  dy,
int &  vx,
int &  vy 
)

Convert local GL co-ordinates into image co-ordinates

Parameters:
dx The local GL x co-ordinate to convert
dy The local GL y co-ordinate to convert
vx The returned image x co-ordinate
vy The returned image y co-ordinate
double CVD::VideoDisplay::video_width (  )  const [inline]

What is the width of the local GL co-ordinates displayed?

Definition at line 159 of file videodisplay.h.

Window CVD::VideoDisplay::window (  )  [inline]

Which is my window?

Definition at line 187 of file videodisplay.h.

void CVD::VideoDisplay::zoom_in ( double  cx,
double  cy,
double  factor = 2 
)

Change the image mapping to zoom in around the specified point

Parameters:
cx The x co-ordinate of the zoom centre
cy The y co-ordinate of the zoom centre
factor The zoom factor (default 2)
void CVD::VideoDisplay::zoom_out ( double  cx,
double  cy,
double  factor = 2 
) [inline]

Change the image mapping to zoom out around the specified point

Parameters:
cx The x co-ordinate of the zoom centre
cy The y co-ordinate of the zoom centre
factor The zoom factor (default 2)

Definition at line 152 of file videodisplay.h.

void CVD::VideoDisplay::zoom_reset (  )  [inline]

Reset the image mapping to that when the VideoDisplay was created.

Definition at line 155 of file videodisplay.h.


Friends And Related Function Documentation

int defAttr[] [related]

The default GLX display request, corresponding to the minimum specification Gl display visual (8-bit colour)

Definition at line 76 of file videodisplay.h.


Member Data Documentation

double CVD::VideoDisplay::my_bottom [private]

Definition at line 193 of file videodisplay.h.

Colormap CVD::VideoDisplay::my_cmap [private]

Definition at line 205 of file videodisplay.h.

Display* CVD::VideoDisplay::my_display [private]

Definition at line 202 of file videodisplay.h.

GLXContext CVD::VideoDisplay::my_glx_context [private]

Definition at line 204 of file videodisplay.h.

double CVD::VideoDisplay::my_left [private]

Definition at line 190 of file videodisplay.h.

Definition at line 200 of file videodisplay.h.

Definition at line 197 of file videodisplay.h.

Definition at line 199 of file videodisplay.h.

Definition at line 201 of file videodisplay.h.

Definition at line 198 of file videodisplay.h.

Definition at line 195 of file videodisplay.h.

Definition at line 194 of file videodisplay.h.

double CVD::VideoDisplay::my_right [private]

Definition at line 192 of file videodisplay.h.

double CVD::VideoDisplay::my_scale [private]

Definition at line 196 of file videodisplay.h.

double CVD::VideoDisplay::my_top [private]

Definition at line 191 of file videodisplay.h.

XVisualInfo* CVD::VideoDisplay::my_visual [private]

Definition at line 203 of file videodisplay.h.

Window CVD::VideoDisplay::my_window [private]

Definition at line 206 of file videodisplay.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:53 2013