Closed XDinEuro closed 2 years ago
This is based on memory, but if you assign the scene data with an empty scene, it doesn't know where to place the camera based on the bounding boxes of the not-yet-loaded objects.
If you press spacebar, it re-calculates the scene and places the camera at a new default location. This can also be accomplished using the viewer->home() function.
Thanks for the quick reply. It helps.
May I ask why zoom in/out doesn't work if this happens?
I was using openscenegraph 3.4 before, it was super smooth. Recently I am migrating my project to osg 3.6.5 and I found a weird bug about not being able to zoom in or out when wheeling mouse.
And I locate the issue to minimum example.
This will give u a all black view, which is inside the cow. and you can't zoom out... But if you put
root->addChild(modelNode)
one line before, which means beforeviewer->setSceneData(root)
, everything works good.If I remove
viewer->setUpViewInWindow(0, 0, 640, 480);
, this works again..Bad View:
Normal View;
I didn't have time to try out in which version it turned out like this. I hope someone can give me some feedback if u know the solution.