-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenSceneGraph 3.0: Beginner's Guide
Interface developers may work under various GUI systems, and have to integrate the OSG scene graph into their UI widgets. According to the different working strategies of GUIs, it is technically hard to have a universal method of embedding OSG viewers. However, there do exist some tricks we can use to make the integration easier:
Attach the window handle to the inheritedWindowData of the osg::GraphicsContext::Traits class. The window handle's type can be Win32's HWND, X11's Window, and Cocoa's WindowRef. After that, OSG will manage the OpenGL rendering context and drawing calls on the inherited window and thus render the whole scene to the window surface.
The frame() method of the osgViewer::Viewer class should be executed continuously. For this purpose, we can either use a separate thread, or a GUI timer event handler with a short enough interval.
For widgets that support OpenGL drawing calls directly (Qt's QGLWidget, GLUT, FLTK, and so on), use the osgViewer...
Change the font size
Change margin width
Change background colour