Hi Mathias,

On 8/29/07, Matthias Weigand <[EMAIL PROTECTED]> wrote:
> thanks for your reply. I switched to using the Viewer class. The code is:
>
> #include <osgViewer/Viewer>
> using namespace osg;
> int main()
> {
>     osgViewer::Viewer* wnds = new osgViewer::Viewer();
>     wnds->setUpViewOnSingleScreen();
>     wnds->realize();
>     return 0;
> }
>
> Calling realize() crashes my app with a segfault.
> No error message is written to stdout or stderr during execution.
>
> I'm using Visual Studio 8 on WinXP Pro SP2 (32-bit).
> My OpenSceneGraph version is the official stable 2.0.
> I build up a clean project with include-dir
> D:\SDK\OpenSceneGraph\include and lib-dir D:\SDK\OpenSceneGraph\lib and
> osg.lib as additional library. No ATL, no MFC, nothing.
>
> What may cause such a problem?

I presume your code extract is psedo code as it has a number of issues.

First up if you are going to create a viewer on the heap via new  use
ref_ptr<Viewer> instead of a C pointer to make sure the memory is
cleaned up correctly.

Second, there is now scene assignment i.e. viewer.setSceneData(mySceneGraph);

Third, your realize the viewer but then do run any frame loop of any
kind, so you at minimum need to add a viewer.run().

All of this illustrated in the examples.

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

Reply via email to