On Jan 23, 2008 9:28 AM, Stephen Northcott <[EMAIL PROTECTED]> wrote:
> My question was simply is there anything I need to be aware of other
> than the usual push'es and pops that we do then splicing pure openGL
> and OSG together?

There is no low difference w.r.t OpenGL/OSG integration in 2.x
relative to 1.x, both requiring you to insulate the OpenGL state
changes done by both your OpenGL calls and the ones that OSG does and
visa-versa.

> And in the old OSG demo main loops we had several calls. cull, draw
> etc. Now we only have one call.
> When is it save to manipulate the OpenGL pipeline, should we do any
> waiting before or after the viewer.frame() call?
> OR can we just blast away at OpenGL as we wish outside of this call?

viewer.frame() just a high level convinience function, have a look at
the implementation and you'll find its equivalent to:

    viewer.advance();
    viewer.eventTraversal();
    viewer.updateTraversal();
    viewer.renderingTraversals();

This is actually not too far away from the osgProducer::Viewer days,
save for the meaning of frame() now encompasses all that is required
to do a frame() and that sync() is now embedded in
renderingTraversals().

W.r.t when you can safely call OpenGL, just like before its only safe
to do so from the thread that has the OpenGL context current.  This is
the same Producer/osgProducer/osgViewer in fact any OpenGL app.  The
different between osgProducer and osgViewer is that the former could
only run single threaded when one has one window, while the later can
run multi-threaded even in the case of one window apps, and by default
will run multi-threaded if you have mult-core CPU.

The upshot of this is that you cannot assume the main thread has
graphics context, and its not not safe to call OpenGL from the main
loop unless you explictly select SingleThreaded.

The next question has to be well how to do you do safe OpenGL calls
with the new multi-threaded viewer?  The easiest way is to add a
Camera post DrawCallback to the master Camera.

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

Reply via email to