I'll try to be a little less mysterious (and probably more annoying) to let you
help me better :P
What I need is to render a scene into RGBE format. It all works fine until I
have to render models with an alpha < 1.0. Obviously the default pipeline cannot
handle blending in rgbe format, so I have to do it myself.
My plan was to sort the nodes with setSortTrans(true), render all opaque
geometry and then, for each transparent node present on the scene, copy the
current fbo color texture and pass it to a shader able to perform the RGBE
blending operation between the new geometry fragments and the underlying pixels.
I tried to use the registerEnterFunction() and registerLeaveFunction() to be
able to copy the color attachment texture just in the middle of the rendering,
but it seems it doesn't work as it should.

agent->getRenderAction()->registerLeaveFunction(Geometry::getClassType(),
        osgTypedMethodFunctor2ObjPtrCPtrRef
                <
                        Action::ResultE, HDRRenderNode,
                        CNodePtr,
                        Action *
                >(
                        this,
                        &HDRRenderNode::afterRenderObject
                )
        );

For testing purposes I set the setFboOn(false), GLUT_SINGLE buffer, and
registered the following functions to the RenderAction:

OSG::Action::ResultE
HDRRenderNode::afterRenderObject( OSG::CNodePtr &, OSG::Action * action ) {
   RenderAction *ra = dynamic_cast<RenderAction*>(action);
   OSG::NodePtr node = action->getActNode();
   glFlush();

   int a;
   scanf("%d", &a);

   return pCore->renderActionHandler(ra);
}

OSG::Action::ResultE
HDRRenderNode::afterRenderObject( OSG::CNodePtr &, OSG::Action * action ) {
   RenderAction *ra = dynamic_cast<RenderAction*>(action);
   OSG::NodePtr node = action->getActNode();
   glFlush();
   glFinish();

   pCore->renderActionHandler(ra);

   int a;
   scanf("%d", &a);

   return OSG::Action::ResultE::Continue;
}

What I'd expect is to see is the scene composing little by little. The first
geometry, then the first geometry + the second one, and so on.. Instead, what
I'm getting is a number of identical empty steps that just show the viewport
background, and then the scene completely rendered in the end.

What am I doing wrong?!
Thank you again,
Stefano

Scrive [EMAIL PROTECTED]:

> Hi Carsten,
>     what I need is a copy of the pixel data. Your proposed method implies an
> fboviewport->setReadBuffer(true) (with an heavy glReadPixels!), which would
> be
> too slow for my needs. Is there any faster method like a glCopy that I could
> use out-of-the-box? Or I should extend the fboviewport functionality myself?
>
> Thanks for your help,
> Stefano
>
> Scrive Carsten Neumann <[EMAIL PROTECTED]>:
> > [EMAIL PROTECTED] wrote:
> >  >> Hi there,
> >  >>    i was looking for some kind of method to copy a FBOViewport
> >  >> GL_COLOR_ATTACHMENTX TextureChunk into another TextureChunk..
> > >> something like
> > > TextureChunkPtr copiedTex = TextureChunk::create();
> > > fboviewport->copyToTexture( GL_COLOR_ATTACHMENT0_EXT, copiedTex );
> > >                                                       ^^^^^^^^^
> > > sorry for the typo. Also, in case I'll have to extend the FBOViewport
> > myself,
> > > what could be the best opengl command to use?
> >
> > do you need a copy of the actual pixel data of the texture (e.g. because
> > you want to change them without affecting the original data) or do you
> > just want to use the data in another texture?
> >
> > For the first case you would have to create a copy of TextureChunks Image:
> >
> > ImagePtr        texImg    = fboviewport->getTextures[0]->getImage();
> > ImagePtr        copiedImg = Image::create();
> > TextureChunkPtr copiedTex = TextureChunk::create();
> >
> > beginEditCP(copiedImg);
> >      copiedImg->set(texImg);
> > endEditCP  (copiedImg);
> >
> > beginEditCP(copiedTex);
> >      copiedTex->setImage(copiedImg);
> > endEditCP  (copiedTex);
> >
> > For the second case just add the image to a second TextureChunk:
> >
> > ImagePtr        texImg    = fboviewport->getTextures[0]->getImage();
> > TextureChunkPtr copiedTex = TextureChunk::create();
> >
> > beginEditCP(copiedTex);
> >      copiedTex->setImage(texImg);
> > endEditCP  (copiedTex);
> >
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to