[osg-users] OperationsThread(OSG 2.0) example

Rahul Srivastava rahul at darshan3d.com
Wed Apr 2 04:15:13 PDT 2008


Hi Robert,

Thanks for the reply. Actually I want to use OperationsThread to execute 
an operation without using the graphics context. In the code snippet 
that I sent you, when I use a debugger to step into the "t->add(...)" 
call, it actually steps into OperationsThread::run(...), where it 
blocks.  Can you tell me why is it stepping into run(...) when I'm 
calling add(...)?

-- 
Rahul Srivastava,
Member of Technical Staff,
Visualization Experts Limited.
www.vizexperts.com
+91-98738-85880 (M)



Robert Osfield wrote:
> HI Rahul,
>
> The GraphicsContext "has a" osg::GraphicsThreads, and
> osg::GraphicsThread subclasses from osg::OperationThread.  There is
> also the osg::GraphicsOperation that can be used in place on
> osg::Operation as this gives you the graphics context as a functor
> parameters.
>
> One thing to be aware of w.r.t GraphicsThreads's operation list is
> that osgViewer itself will set it up.  There is a operation list in
> GraphicsContext that you could probably leverage though.
>
> Robert.
>
> On Wed, Apr 2, 2008 at 10:44 AM, Rahul Srivastava <rahul at darshan3d.com> wrote:
>   
>> Hi Robert,
>>
>>  I looked at the Viewer code also but could not figure out how to make
>>  Operation work without the graphics context. Here's a sample program I
>>  wrote. Is there something wrong with what I'm doing?
>>
>>  The program seems to wait for a condition at the line "t->add(...)" and
>>  doesn't respond.
>>
>>  --snip--
>>
>>  OpenThreads::Thread::Init();
>>
>>  osg::ref_ptr<osg::OperationsThread> t = new osg::OperationsThread;
>>
>>  osg::ref_ptr<osg::Operation> o = new TestOperation;
>>
>>  t->add(o.get(), false);
>>
>>  t->startThread();
>>
>>  --snip--
>>
>>  Regards,
>>
>>  --
>>
>> Rahul Srivastava,
>>  Member of Technical Staff,
>>  Visualization Experts Limited.
>>  www.vizexperts.com
>>  +91-98738-85880 (M)
>>
>>
>>
>>
>>
>> Robert Osfield wrote:
>>  > HI Rahul,
>>  >
>>  > grep is your friend...
>>  >
>>  >
>>  >> grep "osg::Operation" examples/*/*.cpp -l
>>  >>
>>  > examples/osgcatch/osgcatch.cpp
>>  > examples/osgmotionblur/osgmotionblur.cpp
>>  > examples/osgterrain/osgterrain.cpp
>>  > examples/osgtext/osgtext.cpp
>>  >
>>  >
>>  > You'll also find OperationThread and custom Operations in action in
>>  > VirtualPlanetBuilder.
>>  >
>>  > osgViewer also makes use of them.
>>  >
>>  > Robert.
>>  >
>>  > On Tue, Apr 1, 2008 at 6:49 AM, Rahul Srivastava <rahul at darshan3d.com> wrote:
>>  >
>>  >> Hi Robert,
>>  >>
>>  >>  Is there an example for using OperationsThread/Operation for OSG 2.0? I
>>  >>  tried looking at the GraphicsContext source which uses a graphicsThread
>>  >>  but could not figure out how it used the operations thread.
>>  >>
>>  >>  --
>>  >>  Rahul Srivastava,
>>  >>  Member of Technical Staff,
>>  >>  Visualization Experts Limited.
>>  >>  www.vizexperts.com
>>  >>  +91-98738-85880 (M)
>>  >>
>>  >>  _______________________________________________
>>  >>  osg-users mailing list
>>  >>  osg-users at lists.openscenegraph.org
>>  >>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>  >>
>>  >>
>>  > _______________________________________________
>>  > osg-users mailing list
>>  > osg-users at lists.openscenegraph.org
>>  > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>  >
>>  _______________________________________________
>>  osg-users mailing list
>>  osg-users at lists.openscenegraph.org
>>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>     
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>   


More information about the osg-users mailing list