[osg-users] osgParticle and osgPPU not compatible

Art Tevs stud_info2 at yahoo.de
Wed Sep 17 11:00:11 PDT 2008


Hi Robert,

yes it does. However it just pass the visitor down to the scene graph (in this case it must be a graph of units). If the unit graph wasn't initialized before, then it use it's own visitor implementation to setup subgraph. It doesn't change the visitor content or anything else.

I am using osgPPU for all of my graphic application and there the particles do just work fine. I will test a simple scene with particles by adding them into any example from the osgPPU examples. Let see what if I could recreate the error Alex has found.

cheers,
art


--- Robert Osfield <robert.osfield at gmail.com> schrieb am Mi, 17.9.2008:

> Von: Robert Osfield <robert.osfield at gmail.com>
> Betreff: Re: [osg-users] osgParticle and osgPPU not compatible
> An: "OpenSceneGraph Users" <osg-users at lists.openscenegraph.org>
> Datum: Mittwoch, 17. September 2008, 17:00
> Hi Alex and Art,
> 
> Does osgPPU::Processor do anything to the update/event
> traversals?
> 
> Robert.
> 
> On Wed, Sep 17, 2008 at 3:29 PM, alexandre amyot murray
> <alex.amyotmurray at gmail.com> wrote:
> > Hi Art and Robert,
> >
> > First of all I dont use my own viewer class, I use
> osgViewer. I initialize
> > the viewer camera like this to support osgPPU :
> >
> >     // Set single thread model
> >    
> viewer_.setThreadingModel(osgViewer::Viewer::SingleThreaded);
> >
> >     // Set the main window position and size
> >     osg::ref_ptr<osg::GraphicsContext::Traits>
> traits = new
> > osg::GraphicsContext::Traits;
> >     traits->x                =
> windowProperties_.winXPos_;
> >     traits->y                =
> windowProperties_.winYPos_;
> >     traits->width            =
> windowProperties_.winWidth_;
> >     traits->height           =
> windowProperties_.winHeight_;
> >     traits->windowDecoration = false;
> >     traits->doubleBuffer     = true;
> >     traits->sharedContext    = 0;
> >
> >     // Set the graphics context for the camera
> >     osg::ref_ptr<osg::GraphicsContext> gc =
> >
> osg::GraphicsContext::createGraphicsContext(traits.get());
> >     gc->setClearColor( osg::Vec4(0.0f, 0.0f, 0.0f,
> 1.0f) );
> >     gc->setClearMask( GL_COLOR_BUFFER_BIT |
> GL_DEPTH_BUFFER_BIT );
> >     gc->clear( );
> >    
> viewer_.getCamera()->setGraphicsContext(gc.get());
> >
> >     // Set the viewport
> >     viewer_.getCamera()->setViewport(
> viewportProperties_.viewportXPos_,
> >                                      
> viewportProperties_.viewportYPos_,
> >                                      
> viewportProperties_.viewportWidth_,
> >                                      
> viewportProperties_.viewportHeight_ );
> >
> >
> >     // Set the projection matrix as perspective
> >     double aspectRatio;
> >     if(
> >
> viewportProperties_.viewportWidth_/viewportProperties_.viewportHeight_
> >=
> > 1.0 )
> >         aspectRatio =
> >
> viewportProperties_.viewportWidth_/viewportProperties_.viewportHeight_;
> >     else
> >         aspectRatio =
> >
> viewportProperties_.viewportHeight_/viewportProperties_.viewportWidth_;
> >
> >    
> viewer_.getCamera()->setProjectionMatrixAsPerspective(
> > cameraProperties_.cameraFovy_,
> >                                                       
>     aspectRatio,
> >
> > cameraProperties_.cameraZNear_,
> cameraProperties_.cameraZFar_ );
> >
> >     // Positioning the camera
> >     osg::Matrix camTrans;
> >     camTrans.makeTranslate(
> cameraProperties_.cameraPos_.x(),
> > cameraProperties_.cameraPos_.y(),
> -cameraProperties_.cameraPos_.z() );
> >     viewer_.getCamera()->setViewMatrix( camTrans );
> >
> >     // tell the camera to use OpenGL frame buffer
> object where supported.
> >
> >
> viewer_.getCamera()->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
> >
> >     // create texture to render to
> >     osg::Texture* texture = createRenderTexture(
> > viewportProperties_.viewportWidth_,
> viewportProperties_.viewportHeight_,
> > false );
> >     osg::Texture* depthTexture = createRenderTexture(
> > viewportProperties_.viewportWidth_,
> viewportProperties_.viewportHeight_,
> > true);
> >
> >     // attach the texture and use it as the color and
> depth buffer.
> >    
> viewer_.getCamera()->attach(osg::Camera::COLOR_BUFFER,
> texture);
> >    
> viewer_.getCamera()->attach(osg::Camera::DEPTH_BUFFER,
> depthTexture);
> >
> > Ok then I build my particle scene using osgParticle. I
> use a ModularEmitter
> > for the placer, shooter and counter.
> >
> > Finally I set the osgPPU::Processor and attach all the
> unit I need for the
> > shader rendering. Then I set the viewer scene data and
> start the main loop
> > which look like this :
> >
> >     osg::Group * rootGroupNode = new osg::Group();
> >     rootGroupNode->addChild( myParticleScene );
> >     rootGroupNode->addChild( myOsgPpuProcessor );
> >     viewer_.setSceneData( rootGroupNode_.get() );
> >
> >     while (!viewer_.done())
> >     {
> >         if( checkForNewMedias() )
> >             updateSceneWithMedia();
> >
> >         updateScene();
> >
> >         // Draw the next frame.
> >         rendering_ = true;
> >         viewer_.frame();
> >         rendering_ = false;
> >
> >         Sleep(1);
> >     }
> >
> > And the application crash with the error message I
> provide you. If I comment
> > these lines in my viewer application :
> >
> >     // Set single thread model
> >    
> //viewer_.setThreadingModel(osgViewer::Viewer::SingleThreaded);
> >
> >     // tell the camera to use OpenGL frame buffer
> object where supported.
> >
> >
> //viewer_.getCamera()->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
> >
> >     // create texture to render to
> >     //osg::Texture* texture = createRenderTexture(
> > viewportProperties_.viewportWidth_,
> viewportProperties_.viewportHeight_,
> > false );
> >     //osg::Texture* depthTexture =
> createRenderTexture(
> > viewportProperties_.viewportWidth_,
> viewportProperties_.viewportHeight_,
> > true);
> >
> >     // attach the texture and use it as the color and
> depth buffer.
> >    
> //viewer_.getCamera()->attach(osg::Camera::COLOR_BUFFER,
> texture);
> >    
> //viewer_.getCamera()->attach(osg::Camera::DEPTH_BUFFER,
> depthTexture);
> >
> > And don't attach the osgPPU::Processor to my
> rootGroupNode, everything works
> > well.
> >
> > Hope I gave you enough informations, if you need more
> I'll provide you.
> >
> > Thanks
> >
> > Alex
> >
> >
> >
> >
> > _______________________________________________
> > 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

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 



More information about the osg-users mailing list