Hi Robert,

Thanks for the clarification. I totally agree that calling sceneView->init() 
early is at best a "work-around", but it does allow me to keep making progress 
on other things, so a necessary evil :)

I will try your suggested changes to the init traversal.

BTW a sample win32 project is coming, but it may need to wait until the weekend 
(pesky work getting in the way again ...).

Cheers,
Gian

-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Robert Osfield
Sent: Wed 8/30/2006 8:53 PM
To: osg users
Subject: Re: [osg-users] Problem loading model on 1.1rc1
 
Hi Harri et. al.,

Thanks for the feedback.

Calling init() before loading the model, also implies calling init before a
graphics context, especially in the osgGLUTkeyboardmouse example.  Calling
init() before the graphics context is created is actually a bug, and it
should never be called before the graphics context is created as it does
OpenGL calls.   I believe the only reason why this isn't crashing is that
with no scene graph present there is no OpenGL obejcts to initialize so one
never falls foul of the requirement for a graphics context.  This doesn't
make it a sensible thing to do though...

My guess why calling init before loading the model first is down to the init
switching its self off after the first call.  If you don't do this then the
OSG will automatically call init on the first draw call.   The init
traversal is actually done by default by the osgUtil::GLObjectsVisitor,
which will compile all OpenGL objects like display lists and texture
objects.  From the pattern of problem it looks like compiling of display
lists is the problem, but rather than an OSG bug I'd think this is in fact
and OpenGL driver bug.

One way to confirm this would be to set the init visitor manually, rather
than let the default GLObjectVisitor be used.


So you could disabling the init traversal completely:

   sceneview->setDefaults(); // as usual, this will set up a default init
visitor as GLObjectsVisitor
   sceneview->setInitVisitor(0); // reset the init visitor to a null so that
no init traversal occurs

   //  reset of appp

And then re-enable it but without the compilation of display lists:

   sceneview->setDefaults();// as usual, this will set up a default init
visitor as GLObjectsVisitor
   sceneview->setinitVisitor(new
osgUtil::GLobjectsVisitor(osgUtil::GLobjectsVisitor::COMPILE_STATE_ATTRIBUTES);

As a general note, the init traversal is useful for preventing frame drops
as your move round your scene, as all the OpenGL objects will have been
precompiled. There is no actual harm in not doing the init visitor compile
beyond frame drops, and in the case of display lists they generally arn't as
expensive to compile as textures are for the first time. so the frame drops
might well be acceptable.

The above tests will give us a clearer idea of the problem, but most likely
I think its mostly like a peculiar OpenGL driver bug that gets triggered by
compiling display lists which certain ordering or timing on the dispatch.
Its also worth nting that the way that init traversal is done hasn't changed
for many years, and certainly nothing significant if anything has changed
between 1.0 and the present day.

Robert.

On 8/30/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi Robert,
>
> Sorry for slow reply. I will try to answer some of your questions.
>
> As Gian suggested on his reply to my post, calling init() on
> osgUtil::SceneView instance before loading any models corrects the problem.
>
> > Is this problem hardware/OS/OpenGL driver specific?
>
> I have tested osgglutkeyboardmouse (using cow.osg) model on two different
> platforms, both running Windows XP, one of the using NVIDIA and other one
> 3DLabs videocard.
>
> NVIDIA does not work, 3DLabs works fine.
>
> > Does debug vs release builds make any difference?
>
> Using debug or release builds does not make any difference. The problem
> exists with both of them.
>
> > Any chance of someone creating a minimal application that reproduces
> this
> > problems so that others can test with it?
>
> As Gian mentioned on other post, osgglutkeyboardmouse is a fine example to
> test with. Funny thing was, I downloaded and installed gDEBugger and ran the
> application through it and it worked fine. Run the application from the
> command line though and no model.
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>

<<winmail.dat>>

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to