1
0
Fork 0

Realize viewer explicitly

The osgViewer needs to be "realized" so that, among other things, threading
will start. This is normally done by osgViewer::run, but we don't call
that.
Don't realize graphics contexts; Let osgViewer code do it. This way
osgViewer::isRealized returns the correct answer.
This commit is contained in:
timoore 2009-06-15 08:50:56 +00:00 committed by Tim Moore
parent 862f59aded
commit f0bfb4d137
2 changed files with 2 additions and 2 deletions

View file

@ -196,7 +196,6 @@ GraphicsWindow* WindowBuilder::buildWindow(const SGPropertyNode* winNode)
if (traitsSet) { if (traitsSet) {
GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits); GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits);
if (gc) { if (gc) {
gc->realize();
GraphicsWindow* window = WindowSystemAdapter::getWSA() GraphicsWindow* window = WindowSystemAdapter::getWSA()
->registerWindow(gc, traits->windowName); ->registerWindow(gc, traits->windowName);
if (drawGUI) if (drawGUI)
@ -223,7 +222,6 @@ GraphicsWindow* WindowBuilder::getDefaultWindow()
traits->windowName = "FlightGear"; traits->windowName = "FlightGear";
GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits); GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits);
if (gc) { if (gc) {
gc->realize();
defaultWindow = WindowSystemAdapter::getWSA() defaultWindow = WindowSystemAdapter::getWSA()
->registerWindow(gc, defaultWindowName); ->registerWindow(gc, defaultWindowName);
return defaultWindow; return defaultWindow;

View file

@ -170,6 +170,8 @@ void fgOSMainLoop()
ref_ptr<FGEventHandler> manipulator ref_ptr<FGEventHandler> manipulator
= globals->get_renderer()->getEventHandler(); = globals->get_renderer()->getEventHandler();
viewer->setReleaseContextAtEndOfFrameHint(false); viewer->setReleaseContextAtEndOfFrameHint(false);
if (!viewer->isRealized())
viewer->realize();
while (!viewer->done()) { while (!viewer->done()) {
fgIdleHandler idleFunc = manipulator->getIdleHandler(); fgIdleHandler idleFunc = manipulator->getIdleHandler();
fgDrawHandler drawFunc = manipulator->getDrawHandler(); fgDrawHandler drawFunc = manipulator->getDrawHandler();