Class managing a single graphics context and OSG GraphicsWindow. More...
#include <WGEGraphicsWindow.h>
Public Types | |
enum | KeyEvents { KEYPRESS, KEYRELEASE } |
Event types for the keyEvent() handler. More... | |
enum | MouseEvents { MOUSEPRESS, MOUSERELEASE, MOUSEDOUBLECLICK, MOUSEMOVE, MOUSESCROLL } |
Mouse event types for the mouseEvent() handler. More... | |
Public Member Functions | |
WGEGraphicsWindow (osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height) | |
Default constructor. | |
virtual | ~WGEGraphicsWindow () |
Destructor. | |
osg::ref_ptr < osgViewer::GraphicsWindow > | getGraphicsWindow () |
Getter for m_GraphicsWindow. | |
virtual void | resize (int width, int height) |
Updates size information. | |
virtual void | close () |
Initiates a close event for this viewer. | |
virtual void | keyEvent (KeyEvents eventType, int key) |
Handles key events (if forwarded to this Viewer instance). | |
virtual void | mouseEvent (MouseEvents eventType, int x, int y, int button) |
Handles mouse events forwarded from widget. | |
Protected Member Functions | |
void | createContext (int x, int y, int width, int height) |
Creates a new OpenGL context in the calling thread. | |
Protected Attributes | |
osg::ref_ptr < osgViewer::GraphicsWindow > | m_GraphicsWindow |
OpenSceneGraph render window. | |
osg::ref_ptr < osg::GraphicsContext > | m_GraphicsContext |
OpenSceneGraph render context. | |
osg::ref_ptr< osg::Referenced > | m_WindowData |
Widget window data. |
Class managing a single graphics context and OSG GraphicsWindow.
Definition at line 35 of file WGEGraphicsWindow.h.
Event types for the keyEvent() handler.
Definition at line 66 of file WGEGraphicsWindow.h.
Mouse event types for the mouseEvent() handler.
Definition at line 74 of file WGEGraphicsWindow.h.
WGEGraphicsWindow::WGEGraphicsWindow | ( | osg::ref_ptr< osg::Referenced > | wdata, | |
int | x, | |||
int | y, | |||
int | width, | |||
int | height | |||
) |
Default constructor.
wdata | the WindowData instance for the widget to use as render widget. NULL on Mac! | |
x | X coordinate of widget where to create the context. | |
y | Y coordinate of widget where to create the context. | |
width | Width of the widget. | |
height | Height of the Widget. |
WGEInitFailed | thrown if initialization of graphics context or graphics window has failed. |
Definition at line 31 of file WGEGraphicsWindow.cpp.
References createContext(), m_GraphicsWindow, and m_WindowData.
WGEGraphicsWindow::~WGEGraphicsWindow | ( | ) | [virtual] |
Destructor.
Definition at line 59 of file WGEGraphicsWindow.cpp.
void WGEGraphicsWindow::close | ( | ) | [virtual] |
Initiates a close event for this viewer.
It destroys the graphics context and invalidates the viewer. This should be called whenever a QT Widget closes to also free its OSG Viewer resources.
Definition at line 119 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
void WGEGraphicsWindow::createContext | ( | int | x, | |
int | y, | |||
int | width, | |||
int | height | |||
) | [protected] |
Creates a new OpenGL context in the calling thread.
Needs to be called before any other OpenGL operation.
x | X coordinate of widget where to create the context. | |
y | Y coordinate of widget where to create the context. | |
width | Width of the widget. | |
height | Height of the Widget. |
Definition at line 70 of file WGEGraphicsWindow.cpp.
References m_GraphicsContext, m_GraphicsWindow, and m_WindowData.
Referenced by WGEGraphicsWindow().
osg::ref_ptr< osgViewer::GraphicsWindow > WGEGraphicsWindow::getGraphicsWindow | ( | ) |
Getter for m_GraphicsWindow.
Definition at line 64 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
void WGEGraphicsWindow::keyEvent | ( | KeyEvents | eventType, | |
int | key | |||
) | [virtual] |
Handles key events (if forwarded to this Viewer instance).
key | the key code. | |
eventType | the type of event. |
Definition at line 124 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
void WGEGraphicsWindow::mouseEvent | ( | MouseEvents | eventType, | |
int | x, | |||
int | y, | |||
int | button | |||
) | [virtual] |
Handles mouse events forwarded from widget.
eventType | the event type. | |
x | x coordinate of event. | |
y | y coordinate of event. | |
button | mouse button. |
Definition at line 137 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
void WGEGraphicsWindow::resize | ( | int | width, | |
int | height | |||
) | [virtual] |
Updates size information.
width | new width. | |
height | new height. |
Definition at line 113 of file WGEGraphicsWindow.cpp.
References m_GraphicsWindow.
osg::ref_ptr<osg::GraphicsContext> WGEGraphicsWindow::m_GraphicsContext [protected] |
OpenSceneGraph render context.
Definition at line 131 of file WGEGraphicsWindow.h.
Referenced by createContext(), and WGEViewer::WGEViewer().
osg::ref_ptr<osgViewer::GraphicsWindow> WGEGraphicsWindow::m_GraphicsWindow [protected] |
OpenSceneGraph render window.
Definition at line 115 of file WGEGraphicsWindow.h.
Referenced by close(), createContext(), getGraphicsWindow(), keyEvent(), mouseEvent(), resize(), WGEGraphicsWindow(), and WGEViewer::WGEViewer().
osg::ref_ptr<osg::Referenced> WGEGraphicsWindow::m_WindowData [protected] |
Widget window data.
Definition at line 136 of file WGEGraphicsWindow.h.
Referenced by createContext(), and WGEGraphicsWindow().