Yup, the mfc example is broken.
If you don't mind it being single threaded, have a look at the osgViewerGtk one.
I adapted that to work with OwlNext2 in about half an hour.

you want something like this:

osgViewer::GraphicsWindow* m_pWindow = m_pViewer->setUpViewerAsEmbeddedInWindow(0, 0, rect.right, rect.bottom); osgViewer::Viewer* m_pViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);

then forward window events on using

  void TGlWindow::EvMouseMove(uint /*modKeys*/, TPoint& point)
  {
     m_pWindow->getEventQueue()->mouseMotion(point.x, point.y);
  }

Repeat for other windows messages.

Not sure what's wrong with the MFC one at the mo, I was going to start poking around
but then it was the end of the working day! :)

Jesper D. Thomsen wrote:
Hi again all,
I have an existing MFC application with a window based on Cview, which have been used as an OpenGL rendering canvas. I have now disabled the OpenGL rendering of the window and instead replicated the osgviewermfc example in my application in exactly the same way as in the example. The problem is that I can't get my model to render, even though the backgroundcolor is defined and rendered by the osg viewer. When debugging the application I noticed that the viewer-view-_slaves-[0]-_projectionOffset-_mat-[0]...[3]-[0] values change from their initialisation from "addslave" to "-1.#IND00000000000" right after i dispatch the rendering thread. This off course causes further problems in frame() with other values going bad. My question is whether OSG could be doing this, or if it must be the original application writing somewhere it shouldn't? Or does OSG use som standard OpenGL variables which might be overwritten by the existing application? Regards, and I know this problem is rightly irritating, but I hope somebody can give me some hints.
Jesper D. Thomsen

------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to