Hi Bill,

I don't have anything more to suggest, you'll just need to add
debugging/step through the code yourself to see whats happening/and
compare this to what you are expecting.

My only closing thought would be perhpas FBO's don't support or
perhaps OSG's version of FBO's don't support  changing the assinged
texture.

Robert.

On 4/23/07, Poirier, Guillaume <[EMAIL PROTECTED]> wrote:

Hi Robert,

No I don't have any OpenGL errors reported...

I meant bind as setTextureAttributeAndModes(), i.e.
in my update callback I do:

virtual void operator() (osg::Node* node, osg::NodeVisitor* nv)
{
      // pre-traverse
      //------------------------

      printf("Pass %i\n", m_Counter+1);
      printf("========================\n");

      // NOTE: we swap input / output textures at each pass

      // bind input texture for first branch
      m_pBranch1SS->setTextureAttributeAndModes(2,
          (m_Counter%2==0)? m_TexSwapA.get() : m_TexSwapB.get(),
          osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
      printf("1st branch: Binding texture %p to unit %i\n", (m_Counter%2==0)? 
m_TexSwapA.get() : m_TexSwapB.get(), 2);

      // bind render to texture
      m_pRTTCam->attach(osg::Camera::COLOR_BUFFER, (m_Counter%2==0)? 
m_TexSwapB.get() : m_TexSwapA.get());
      printf("Attaching texture %p to camera color buffer\n", (m_Counter%2==0)? 
m_TexSwapB.get() : m_TexSwapA.get());

      // bind input texture for second branch
      m_pBranch2SS->setTextureAttributeAndModes(3,
          (m_Counter%2==0)? m_TexSwapB.get() : m_TexSwapA.get(),
          osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
      printf("2nd branch: Binding texture %p to unit %i\n", (m_Counter%2==0)? 
m_TexSwapB.get() : m_TexSwapA.get(), 3);

      traverse(node,nv);

      // post-traverse
      //------------------------

      m_Counter++;
}

Bill

-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Robert Osfield
Sent: Mon 4/23/2007 10:45 AM
To: osg users
Subject: Re: [osg-users] Camera attachments

On 4/23/07, Poirier, Guillaume <[EMAIL PROTECTED]> wrote:
> I also tried what you suggest without result :( Is there a way to test
> if the frame buffer attachment failed ?

If it fails you should get OpenGL errors reported.

> In the update callback I bind
> tex A (or B on odd frames) to Dummy group 0's state set, attach tex B (or A) 
to the
> RTT cam color attachment, and bind tex B (or A) to Dummy group 1's
> state set.

What do you mean by bind? An binding of OpenGL objects, in which case
you are going to have trouble, you can only do OpenGL ops in an OpenGL
thread.

I'm afraid I can only point you in the what I think might be the right
direction, I do have time to walk you through to a solution.

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


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


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

Reply via email to