I never managed to change the camera texture attachment but using two branches 
with two cameras and two switch nodes does the trick... Thanks again for your 
help !
 
bill 

________________________________

From: [EMAIL PROTECTED] on behalf of Poirier, Guillaume
Sent: Wed 25/04/2007 4:57 PM
To: osg users
Subject: RE: [osg-users] Camera attachments




Hi, 

Thanks a lot for your help ! I put callbacks in all my nodes to double 
check that everything is updated and drawn as I think it is... I also 
tried to always render to a third texture 'C', swapping in the update 
callback read input textures A and B on each frame, and it works as 
expected. 

Regarding your comment that "perhpas FBO's don't support or 
perhaps OSG's version of FBO's don't support  changing the assinged 
texture", is there anybody out there that has managed to do it, i.e. 
change the texture attachment of a camera on each update and 
use that texture as input to a state set in another branch of the 
scene graph ? 


bill 


-----Original Message----- 
From: [EMAIL PROTECTED] on behalf of Robert Osfield 
Sent: Mon 4/23/2007 3:54 PM 
To: osg users 
Subject: Re: [osg-users] Camera attachments 
  
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/ 

<<winmail.dat>>

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

Reply via email to