63 if (info.
rgbaBits().
a()) flags |= GLUT_ALPHA;
69 if (info.
stereo()) flags |= GLUT_STEREO;
75 EnumDisplaySettings(
NULL,ENUM_CURRENT_SETTINGS,&devmode);
76 width = devmode.dmPelsWidth;
77 height = devmode.dmPelsHeight;
85 glutInitContextProfile ( GLUT_COMPATIBILITY_PROFILE );
91 glutInitContextProfile ( GLUT_CORE_PROFILE );
101 glutInitDisplayMode( flags );
102 glutInitWindowSize( width, height );
103 glutInitWindowPosition( x, y );
109 glutSetWindow(
handle() );
119 glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);
133 #if !defined(__APPLE__) 137 glutReshapeWindow(width, height);
141 #if !defined(__APPLE__) 308 int prev = glutGetWindow();
309 glutSetWindow(
handle() );
314 EnumDisplaySettings(
NULL,ENUM_CURRENT_SETTINGS,&devmode);
315 int width = devmode.dmPelsWidth;
316 int height = devmode.dmPelsHeight;
317 glutPositionWindow( 0, 0 );
318 glutReshapeWindow( width, height );
324 glutPositionWindow( 0, 0 );
325 glutReshapeWindow( 640, 480 );
327 glutSetWindow( prev );
339 glutSetCursor(GLUT_CURSOR_LEFT_ARROW);
341 glutSetCursor(GLUT_CURSOR_NONE);
346 glutWarpPointer(x,y);
352 glutPostWindowRedisplay(
handle() );
358 glutSetWindow(
handle() );
367 glutDestroyWindow(
handle() );
373 glutPostOverlayRedisplay();
385 int prev = glutGetWindow();
386 glutSetWindow(
handle() );
388 glutSetWindow( prev );
396 int prev = glutGetWindow();
397 glutSetWindow(
handle() );
399 glutSetWindow( prev );
406 glutSetWindow(
handle() );
413 int prev = glutGetWindow();
414 glutSetWindow(
handle() );
416 glutSetWindow( prev );
424 int prev = glutGetWindow();
425 glutSetWindow(
handle() );
426 glutPositionWindow(x, y);
427 glutSetWindow( prev );
435 int prev = glutGetWindow();
436 glutSetWindow(
handle() );
437 glutReshapeWindow(w, h);
438 glutSetWindow( prev );
446 int prev = glutGetWindow();
447 glutSetWindow(
handle() );
448 vl::ivec2 v( glutGet(GLUT_WINDOW_X), glutGet(GLUT_WINDOW_Y) );
449 glutSetWindow( prev );
460 int prev = glutGetWindow();
461 glutSetWindow(
handle() );
462 vl::ivec2 v( glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) );
463 glutSetWindow( prev );
623 int modifiers = glutGetModifiers();
624 if (modifiers & GLUT_ACTIVE_SHIFT)
626 if (modifiers & GLUT_ACTIVE_CTRL)
628 if (modifiers & GLUT_ACTIVE_ALT)
634 int cur_win = glutGetWindow();
643 int cur_win = glutGetWindow();
652 int cur_win = glutGetWindow();
661 int cur_win = glutGetWindow();
670 int cur_win = glutGetWindow();
683 if (state == GLUT_DOWN)
686 if (state == GLUT_UP)
692 int cur_win = glutGetWindow();
703 int cur_win = glutGetWindow();
718 int cur_win = glutGetWindow();
728 int cur_win = glutGetWindow();
738 int cur_win = glutGetWindow();
756 int cur_win = glutGetWindow();
769 int cur_win = glutGetWindow();
791 for(std::map< int, GLUTWindow* >::iterator it =
mWinMap.begin(); it !=
mWinMap.end(); ++it)
793 if (it->second->continuousUpdate())
795 it->second->update();
809 static bool alread_called =
false;
817 alread_called =
true;
void setPosition(int x, int y)
If the OpenGL context is a widget this function sets its position.
static void glut_motion_func(int x, int y)
void dispatchKeyReleaseEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener obje...
Vector2< int > ivec2
A 2 components vector with int precision.
static void glut_visibility_func(int visibility)
void dispatchInitEvent()
Dispatches the UIEventListener::initEvent() notification to the subscribed UIEventListener objects...
vl::ivec2 position() const
If the OpenGL context is a widget this function returns its position.
void keyRelease(EKey key)
Removes the specified key from the set of currently active keys - For internal use only...
void setVSyncEnabled(bool enable)
If the OpenGL context is a widget this function enabled/disables double buffer swapping to the monito...
static void glut_close_func()
void setHeight(int height)
The height of a render target.
int stencilBufferBits() const
static void glut_wmclose_func()
bool initGLUTWindow(const vl::String &title, const vl::OpenGLContextFormat &info, int x, int y, int width, int height)
Initializes and shows a GLUT window.
void dispatchMouseDownEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objec...
void makeCurrent()
Sets the OpenGL context as current for the calling thread.
The GLUTWindow class implements an OpenGLContext using the GLUT API.
static void glut_reshape_func(int w, int h)
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
const T_Scalar & r() const
void update()
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent()...
static void shutdown()
Releases all the resources acquired by VLCore and VLGraphics.
vl::EKey mapAsciiKey(unsigned char ascii)
static vl::EKey mapSpecialKey(int special_key)
void dispatchVisibilityEvent(bool visible)
Dispatches the UIEventListener::visibilityEvent() notification to the subscribed UIEventListener obje...
static void glut_idle_func()
void dispatchKeyPressEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener object...
void dispatchResizeEvent(int w, int h)
Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects...
static void glut_display_func()
void setWidth(int width)
The width of a render target.
FramebufferObject * framebuffer()
The default render target (always returns leftFramebuffer()).
void keyPress(EKey key)
Inserts the specified key in the set of currently active keys - For internal use only.
bool setFullscreen(bool fs)
If the OpenGL context is a widget this function requests a maximization to fullscreen.
const T_Scalar & g() const
static void glut_special_func(int key, int x, int y)
void dispatchUpdateEvent()
Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects...
The OpenGLContextFormat class encapsulates the settings of an OpenGL rendering context.
const ivec4 & rgbaBits() const
void setOpenGLContextInfo(const OpenGLContextFormat &info)
Sets the OpenGLContextFormat associated to an OpenGLContext.
void hide()
If the OpenGL context is a widget this function makes it invisible to the user.
int height() const
Returns the height in pixels of an OpenGLContext.
const ivec4 & accumRGBABits() const
static void glut_special_up_func(int key, int x, int y)
int width() const
Returns the width in pixels of an OpenGLContext.
std::map< unsigned char, vl::EKey > mKeymap
static void glut_mouse_func(int button, int state, int x, int y)
const T_Scalar & b() const
void dispatchMouseWheelEvent(int n)
Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener obje...
static void glut_keyboard_up_func(unsigned char ch, int x, int y)
VLGLUT_EXPORT void atexit_visualization_library_shutdown()
EOpenGLProfile openGLProfile() const
void setWindowTitle(const vl::String &title)
If the OpenGL context is a top window this function sets its title.
void swapBuffers()
Swaps the back and front buffers to present the last rendering.
virtual void setMouseVisible(bool visible)
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not...
void dispatchDestroyEvent()
Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener(s), calls destroyAllOpenGLResources() and eraseAllEventListeners() This event must be issued just before the actual GL context is destroyed.
void getFocus()
If the OpenGL context is a widget this function requests the mouse focus on it.
int depthBufferBits() const
static void glut_keyboard_func(unsigned char ch, int x, int y)
void dispatchMouseMoveEvent(int x, int y)
Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objec...
static void glut_passive_motion_func(int x, int y)
void show()
If the OpenGL context is a widget this function makes it visible to the user.
The GLUT bindings namespace.
std::string toStdString() const
Returns a UTF8 encoded std::string.
static void sleep(unsigned int milliseconds)
void setSize(int w, int h)
If the OpenGL context is a widget this function sets its size.
bool initGLContext(bool log=true)
Initializes the supported OpenGL extensions.
static std::map< int, GLUTWindow *> mWinMap
virtual void setMousePosition(int x, int y)
If the OpenGL context is a widget this function sets the mouse position.
bool doubleBuffer() const
static void glut_mouse_wheel_func(int a, int rotation, int c, int d)
const T_Scalar & a() const
void dispatchMouseUpEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects...