[osg-users] Lose view and projection matrix corrupted.

Giulio De Vecchi giulio.devecchi at libero.it
Mon Apr 11 02:08:00 PDT 2011

Hi all,
in my application I have a couple of strange effects I cannot explain.
In a few words:
It is a C# application in which a user defined control:
    class MyControl : UserControl
create an osg viewer via C++/CLI:
On the C++ side we have standard stuff:
    p_hWND = reinterpret_cast<HWND> (wnd);
    traits->inheritedWindowData = new osgViewer::GraphicsWindowWin32::WindowData(p_hWND);
    etc, etc.

On the C++ side I don't have a rendering loop but I call "myViewer->frame()" only when needed.
The two strange effects are:
1) When the application loses the focus, all the objects and the background layer often disappear and all I see is the clear color (i.e. the color set with "MyViewer->getCamera()->setClearColor(...)"). Then I need to set the focus on the panel again and do another call to "myViewer->frame()" to restore the correct view. Is this normal? How can I avoid this?
2) After a few calls to "myViewer->frame()", the projection matrix become corrupted (even if I didn't change anything in the scene), and I need to reset it. I read this article: "http://chadaustin.me/2009/02/ind-and-qnan-with-fpfast/": is it right? Do I need to recompile osg? (currently I'm using precompiled libraries).

Best regards.

Read this topic online here:

More information about the osg-users mailing list