CVD 0.8
|
A cheap and cheerful GL display window using X and the GLX library. More...
#include <videodisplay.h>
Public Member Functions | |
VideoDisplay (double left, double top, double right, double bottom, double scale=1, int *visualAttr=defAttr) | |
VideoDisplay (ImageRef size, double scale=1, int *visualAttr=defAttr) | |
~VideoDisplay () | |
void | set_title (const std::string &s) |
int | get_fd () |
void | select_events (long event_mask) |
void | get_event (XEvent *event) |
void | locate_display_pointer (int &x, int &y) |
void | locate_video_pointer (double &x, double &y) |
void | flush () |
int | pending () |
void | set_zoom (double left, double top, double right, double bottom, double scale) |
void | zoom_in (double cx, double cy, double factor=2) |
void | zoom_out (double cx, double cy, double factor=2) |
void | zoom_reset () |
double | video_width () const |
double | video_height () const |
void | display_to_video (int dx, int dy, double &vx, double &vy) |
void | video_to_display (double dx, double dy, int &vx, int &vy) |
void | make_current () |
void | swap_buffers () |
Display * | display () |
Window | window () |
Related Functions | |
(Note that these are not member functions.) | |
int | defAttr [] |
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.
CVD::VideoDisplay::VideoDisplay | ( | double | left, |
double | top, | ||
double | right, | ||
double | bottom, | ||
double | scale = 1 , |
||
int * | visualAttr = defAttr |
||
) |
Construct (and display) a display window.
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 |
Construct (and display) a display window.
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 |
void CVD::VideoDisplay::set_title | ( | const std::string & | s | ) |
Set the window title.
s | The new title |
void CVD::VideoDisplay::select_events | ( | long | event_mask | ) |
Select which X events to handle (by default, nothing is handled)
event_mask | ORed list of XEvents to handle |
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
event | The next event |
void CVD::VideoDisplay::locate_display_pointer | ( | int & | x, |
int & | y | ||
) |
Where is the mouse pointer in the window?
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?
x | The x co-ordinate |
y | The y co-ordinate |
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.
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 |
Referenced by zoom_reset().
void CVD::VideoDisplay::zoom_in | ( | double | cx, |
double | cy, | ||
double | factor = 2 |
||
) |
Change the image mapping to zoom in around the specified point.
cx | The x co-ordinate of the zoom centre |
cy | The y co-ordinate of the zoom centre |
factor | The zoom factor (default 2) |
Referenced by zoom_out().
void CVD::VideoDisplay::zoom_out | ( | double | cx, |
double | cy, | ||
double | factor = 2 |
||
) | [inline] |
Change the image mapping to zoom out around the specified point.
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.
References zoom_in().
void CVD::VideoDisplay::display_to_video | ( | int | dx, |
int | dy, | ||
double & | vx, | ||
double & | vy | ||
) |
Convert image co-ordinates into local GL co-ordinates.
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::video_to_display | ( | double | dx, |
double | dy, | ||
int & | vx, | ||
int & | vy | ||
) |
Convert local GL co-ordinates into image co-ordinates.
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 |
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.
void CVD::VideoDisplay::swap_buffers | ( | ) |
Swap the front and back GL buffers.
This calls glXSwapBuffers for the current context.
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.