Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The GLUTWindow class implements an OpenGLContext using the GLUT API. More...
#include <GLUTWindow.hpp>
Public Member Functions | |
GLUTWindow () | |
GLUTWindow (const vl::String &title, const vl::OpenGLContextFormat &info, int x, int y, int width, int height) | |
bool | initGLUTWindow (const vl::String &title, const vl::OpenGLContextFormat &info, int x, int y, int width, int height) |
Initializes and shows a GLUT window. | |
~GLUTWindow () | |
virtual void | setMouseVisible (bool visible) |
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not. | |
virtual void | setMousePosition (int x, int y) |
If the OpenGL context is a widget this function sets the mouse position. | |
void | quitApplication () |
Quits the progra calling the C function exit(0). | |
void | update () |
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent(). | |
bool | setFullscreen (bool fs) |
If the OpenGL context is a widget this function requests a maximization to fullscreen. | |
void | makeCurrent () |
Sets the OpenGL context as current for the calling thread. | |
void | updateOverlay () |
void | swapBuffers () |
Swaps the back and front buffers to present the last rendering. | |
void | setWindowTitle (const vl::String &title) |
If the OpenGL context is a top window this function sets its title. | |
int | handle () const |
void | setPosition (int x, int y) |
If the OpenGL context is a widget this function sets its position. | |
void | setSize (int w, int h) |
If the OpenGL context is a widget this function sets its size. | |
vl::ivec2 | position () const |
If the OpenGL context is a widget this function returns its position. | |
vl::ivec2 | size () const |
void | show () |
If the OpenGL context is a widget this function makes it visible to the user. | |
void | hide () |
If the OpenGL context is a widget this function makes it invisible to the user. | |
void | getFocus () |
If the OpenGL context is a widget this function requests the mouse focus on it. | |
Protected Member Functions | |
void | destroyWindow () |
void | initKeymap () |
vl::EKey | mapAsciiKey (unsigned char ascii) |
void | updateModifiers () |
Static Protected Member Functions | |
static vl::EKey | mapSpecialKey (int special_key) |
static void | glut_keyboard_func (unsigned char ch, int x, int y) |
static void | glut_keyboard_up_func (unsigned char ch, int x, int y) |
static void | glut_special_func (int key, int x, int y) |
static void | glut_special_up_func (int key, int x, int y) |
static void | glut_mouse_func (int button, int state, int x, int y) |
static void | glut_motion_func (int x, int y) |
static void | glut_passive_motion_func (int x, int y) |
static void | glut_mouse_wheel_func (int a, int rotation, int c, int d) |
static void | glut_visibility_func (int visibility) |
static void | glut_reshape_func (int w, int h) |
static void | glut_display_func () |
static void | glut_close_func () |
static void | glut_wmclose_func () |
static void | glut_idle_func () |
Protected Attributes | |
std::map< unsigned char, vl::EKey > | mKeymap |
int | mHandle |
bool | mInited |
Static Protected Attributes | |
static std::map< int, GLUTWindow * > | mWinMap |
The GLUTWindow class implements an OpenGLContext using the GLUT API.
Definition at line 59 of file GLUTWindow.hpp.
GLUTWindow::GLUTWindow | ( | ) |
Definition at line 44 of file GLUTWindow.cpp.
GLUTWindow::GLUTWindow | ( | const vl::String & | title, |
const vl::OpenGLContextFormat & | info, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Definition at line 50 of file GLUTWindow.cpp.
References initGLUTWindow(), mHandle, and mInited.
vlGLUT::GLUTWindow::~GLUTWindow | ( | ) | [inline] |
Definition at line 69 of file GLUTWindow.hpp.
bool GLUTWindow::initGLUTWindow | ( | const vl::String & | title, |
const vl::OpenGLContextFormat & | info, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Initializes and shows a GLUT window.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Definition at line 58 of file GLUTWindow.cpp.
References vl::OpenGLContextFormat::accumRGBABits(), vl::OpenGLContextFormat::depthBufferBits(), vl::OpenGLContextFormat::doubleBuffer(), vl::OpenGLContextFormat::fullscreen(), glut_close_func(), glut_display_func(), glut_idle_func(), glut_keyboard_func(), glut_keyboard_up_func(), glut_motion_func(), glut_mouse_func(), glut_mouse_wheel_func(), glut_passive_motion_func(), glut_reshape_func(), glut_special_func(), glut_special_up_func(), glut_visibility_func(), glut_wmclose_func(), handle(), vl::OpenGLContext::initGLContext(), initKeymap(), vl::OpenGLContext::mFullscreen, mHandle, vl::OpenGLContextFormat::multisample(), mWinMap, NULL, vl::OpenGLContextFormat::rgbaBits(), vl::OpenGLContext::setOpenGLContextInfo(), vl::OpenGLContext::setVSyncEnabled(), vl::OpenGLContextFormat::stencilBufferBits(), vl::OpenGLContextFormat::stereo(), vl::String::toStdString(), and vl::OpenGLContextFormat::vSync().
Referenced by GLUTWindow().
void GLUTWindow::setMouseVisible | ( | bool | ) | [virtual] |
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not.
Reimplemented from vl::OpenGLContext.
Definition at line 315 of file GLUTWindow.cpp.
References vl::OpenGLContext::mMouseVisible.
void GLUTWindow::setMousePosition | ( | int | , |
int | |||
) | [virtual] |
If the OpenGL context is a widget this function sets the mouse position.
Reimplemented from vl::OpenGLContext.
Definition at line 324 of file GLUTWindow.cpp.
void vlGLUT::GLUTWindow::quitApplication | ( | ) | [inline, virtual] |
Quits the progra calling the C function exit(0).
Reimplemented from vl::OpenGLContext.
Definition at line 79 of file GLUTWindow.hpp.
void GLUTWindow::update | ( | ) | [virtual] |
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent().
Implements vl::OpenGLContext.
Definition at line 329 of file GLUTWindow.cpp.
References handle().
bool GLUTWindow::setFullscreen | ( | bool | ) | [virtual] |
If the OpenGL context is a widget this function requests a maximization to fullscreen.
Reimplemented from vl::OpenGLContext.
Definition at line 284 of file GLUTWindow.cpp.
References handle(), vl::OpenGLContext::height(), vl::OpenGLContext::mFullscreen, NULL, and vl::OpenGLContext::width().
void GLUTWindow::makeCurrent | ( | ) | [virtual] |
Sets the OpenGL context as current for the calling thread.
Implements vl::OpenGLContext.
Definition at line 335 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::updateOverlay | ( | ) |
Definition at line 351 of file GLUTWindow.cpp.
void GLUTWindow::swapBuffers | ( | ) | [virtual] |
Swaps the back and front buffers to present the last rendering.
Implements vl::OpenGLContext.
Definition at line 356 of file GLUTWindow.cpp.
void GLUTWindow::setWindowTitle | ( | const vl::String & | ) | [virtual] |
If the OpenGL context is a top window this function sets its title.
Reimplemented from vl::OpenGLContext.
Definition at line 389 of file GLUTWindow.cpp.
References handle(), and vl::String::toStdString().
int vlGLUT::GLUTWindow::handle | ( | ) | const [inline] |
Definition at line 93 of file GLUTWindow.hpp.
Referenced by destroyWindow(), getFocus(), hide(), initGLUTWindow(), makeCurrent(), position(), setFullscreen(), setPosition(), setSize(), setWindowTitle(), show(), size(), and update().
void GLUTWindow::setPosition | ( | int | , |
int | |||
) | [virtual] |
If the OpenGL context is a widget this function sets its position.
Reimplemented from vl::OpenGLContext.
Definition at line 400 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::setSize | ( | int | , |
int | |||
) | [virtual] |
If the OpenGL context is a widget this function sets its size.
Reimplemented from vl::OpenGLContext.
Definition at line 411 of file GLUTWindow.cpp.
References handle().
vl::ivec2 GLUTWindow::position | ( | ) | const [virtual] |
If the OpenGL context is a widget this function returns its position.
Reimplemented from vl::OpenGLContext.
Definition at line 422 of file GLUTWindow.cpp.
References handle().
vl::ivec2 GLUTWindow::size | ( | ) | const |
Definition at line 436 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::show | ( | ) | [virtual] |
If the OpenGL context is a widget this function makes it visible to the user.
Reimplemented from vl::OpenGLContext.
Definition at line 361 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::hide | ( | ) | [virtual] |
If the OpenGL context is a widget this function makes it invisible to the user.
Reimplemented from vl::OpenGLContext.
Definition at line 372 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::getFocus | ( | ) | [virtual] |
If the OpenGL context is a widget this function requests the mouse focus on it.
Reimplemented from vl::OpenGLContext.
Definition at line 383 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::destroyWindow | ( | ) | [protected] |
Definition at line 341 of file GLUTWindow.cpp.
References handle().
void GLUTWindow::initKeymap | ( | ) | [protected] |
Definition at line 450 of file GLUTWindow.cpp.
References vl::Key_0, vl::Key_1, vl::Key_2, vl::Key_3, vl::Key_4, vl::Key_5, vl::Key_6, vl::Key_7, vl::Key_8, vl::Key_9, vl::Key_A, vl::Key_Ampersand, vl::Key_Asterisk, vl::Key_At, vl::Key_B, vl::Key_BackSlash, vl::Key_BackSpace, vl::Key_C, vl::Key_Caret, vl::Key_Colon, vl::Key_Comma, vl::Key_D, vl::Key_Delete, vl::Key_Dollar, vl::Key_E, vl::Key_Equal, vl::Key_Escape, vl::Key_Exclam, vl::Key_F, vl::Key_G, vl::Key_Greater, vl::Key_H, vl::Key_Hash, vl::Key_I, vl::Key_J, vl::Key_K, vl::Key_L, vl::Key_LeftBracket, vl::Key_LeftParen, vl::Key_Less, vl::Key_M, vl::Key_Minus, vl::Key_N, vl::Key_O, vl::Key_P, vl::Key_Period, vl::Key_Plus, vl::Key_Q, vl::Key_Question, vl::Key_Quote, vl::Key_QuoteDbl, vl::Key_QuoteLeft, vl::Key_R, vl::Key_Return, vl::Key_RightBracket, vl::Key_RightParen, vl::Key_S, vl::Key_Semicolon, vl::Key_Slash, vl::Key_Space, vl::Key_T, vl::Key_Tab, vl::Key_U, vl::Key_Underscore, vl::Key_V, vl::Key_W, vl::Key_X, vl::Key_Y, vl::Key_Z, and mKeymap.
Referenced by initGLUTWindow().
vl::EKey GLUTWindow::mapAsciiKey | ( | unsigned char | ascii ) | [protected] |
Definition at line 555 of file GLUTWindow.cpp.
References vl::Key_Unknown, and mKeymap.
Referenced by glut_keyboard_func(), and glut_keyboard_up_func().
vl::EKey GLUTWindow::mapSpecialKey | ( | int | special_key ) | [static, protected] |
Definition at line 566 of file GLUTWindow.cpp.
References vl::Key_Down, vl::Key_End, vl::Key_F1, vl::Key_F10, vl::Key_F11, vl::Key_F12, vl::Key_F2, vl::Key_F3, vl::Key_F4, vl::Key_F5, vl::Key_F6, vl::Key_F7, vl::Key_F8, vl::Key_F9, vl::Key_Home, vl::Key_Insert, vl::Key_Left, vl::Key_PageDown, vl::Key_PageUp, vl::Key_Right, vl::Key_Unknown, and vl::Key_Up.
Referenced by glut_special_func(), and glut_special_up_func().
void GLUTWindow::updateModifiers | ( | ) | [protected] |
Definition at line 598 of file GLUTWindow.cpp.
References vl::Key_Alt, vl::Key_Ctrl, vl::Key_Shift, vl::OpenGLContext::keyPress(), and vl::OpenGLContext::keyRelease().
Referenced by glut_keyboard_func(), glut_keyboard_up_func(), glut_mouse_func(), glut_mouse_wheel_func(), glut_special_func(), and glut_special_up_func().
void GLUTWindow::glut_keyboard_func | ( | unsigned char | ch, |
int | x, | ||
int | y | ||
) | [static, protected] |
Definition at line 612 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchKeyPressEvent(), mapAsciiKey(), mWinMap, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_keyboard_up_func | ( | unsigned char | ch, |
int | x, | ||
int | y | ||
) | [static, protected] |
Definition at line 621 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchKeyReleaseEvent(), mapAsciiKey(), mWinMap, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_special_func | ( | int | key, |
int | x, | ||
int | y | ||
) | [static, protected] |
Definition at line 630 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchKeyPressEvent(), mapSpecialKey(), mWinMap, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_special_up_func | ( | int | key, |
int | x, | ||
int | y | ||
) | [static, protected] |
Definition at line 639 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchKeyReleaseEvent(), mapSpecialKey(), mWinMap, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_mouse_func | ( | int | button, |
int | state, | ||
int | x, | ||
int | y | ||
) | [static, protected] |
Definition at line 648 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchMouseDownEvent(), vl::OpenGLContext::dispatchMouseUpEvent(), vl::LeftButton, vl::MiddleButton, mWinMap, vl::RightButton, vl::UnknownButton, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_motion_func | ( | int | x, |
int | y | ||
) | [static, protected] |
Definition at line 670 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchMouseMoveEvent(), mWinMap, and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_passive_motion_func | ( | int | x, |
int | y | ||
) | [static, protected] |
Definition at line 681 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchMouseMoveEvent(), mInited, mWinMap, and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_mouse_wheel_func | ( | int | a, |
int | rotation, | ||
int | c, | ||
int | d | ||
) | [static, protected] |
Definition at line 696 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchMouseWheelEvent(), mWinMap, updateModifiers(), and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_visibility_func | ( | int | visibility ) | [static, protected] |
Definition at line 706 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchVisibilityEvent(), mWinMap, and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_reshape_func | ( | int | w, |
int | h | ||
) | [static, protected] |
Definition at line 716 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchInitEvent(), vl::OpenGLContext::dispatchResizeEvent(), vl::OpenGLContext::framebuffer(), mInited, mWinMap, and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_display_func | ( | ) | [static, protected] |
Definition at line 734 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchRunEvent(), mWinMap, and VL_CHECK.
Referenced by initGLUTWindow().
void GLUTWindow::glut_close_func | ( | ) | [static, protected] |
Definition at line 747 of file GLUTWindow.cpp.
References vl::OpenGLContext::dispatchDestroyEvent(), mHandle, mInited, mKeymap, mWinMap, and VL_CHECK.
Referenced by glut_wmclose_func(), and initGLUTWindow().
void GLUTWindow::glut_wmclose_func | ( | ) | [static, protected] |
Definition at line 763 of file GLUTWindow.cpp.
References glut_close_func().
Referenced by initGLUTWindow().
void GLUTWindow::glut_idle_func | ( | ) | [static, protected] |
Definition at line 768 of file GLUTWindow.cpp.
References mWinMap, and vl::Time::sleep().
Referenced by initGLUTWindow().
std::map<unsigned char, vl::EKey> vlGLUT::GLUTWindow::mKeymap [protected] |
Definition at line 157 of file GLUTWindow.hpp.
Referenced by glut_close_func(), initKeymap(), and mapAsciiKey().
int vlGLUT::GLUTWindow::mHandle [protected] |
Definition at line 158 of file GLUTWindow.hpp.
Referenced by glut_close_func(), GLUTWindow(), and initGLUTWindow().
bool vlGLUT::GLUTWindow::mInited [protected] |
Definition at line 159 of file GLUTWindow.hpp.
Referenced by glut_close_func(), glut_passive_motion_func(), glut_reshape_func(), and GLUTWindow().
std::map< int, GLUTWindow * > GLUTWindow::mWinMap [static, protected] |
Definition at line 161 of file GLUTWindow.hpp.
Referenced by glut_close_func(), glut_display_func(), glut_idle_func(), glut_keyboard_func(), glut_keyboard_up_func(), glut_motion_func(), glut_mouse_func(), glut_mouse_wheel_func(), glut_passive_motion_func(), glut_reshape_func(), glut_special_func(), glut_special_up_func(), glut_visibility_func(), and initGLUTWindow().