[osg-users] Problems when rendering to a FBO texture and using that as a texture.

2007-10-08 Thread Alberto Nortes
Hi!,

We have migrated all the code to the new osgViewer and everything is working
marvelously, but:
In OSG-2.2, with an Nvidia 7800 GT, I create an FBO to render the scene to a
texture, this works correctly, but later if I want to use that texture as an
input I get the following error:

PixelBufferWin32::wglBindTexImageARB(), failed

This used to work while working with osgProducer, but right now I dont know
what can be wrong. Here is some code:

//Render the current scene to a texture.
camera-setRenderOrder(osg::CameraNode::PRE_RENDER);
camera-setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT);

camera-attach(osg::CameraNode::COLOR_BUFFER, _texture_fbo);
camera-addChild(*_total_root*);

_root_camera_fbo-addChild(camera);
_root_camera_fbo-addChild(nested_quad_from_camera);
viewer.setSceneData(_root_camera_fbo);

//Then in another part of the code I do:
osg::Texture2D* _imagen_fbo = getTextureFbo();
*_total_root*-addChild(group);
group-getOrCreateStateset()-setTextureAttributeAndModes(0,
_imagen_fbo,osg::StateAttribute::ON); //This last line provokes the warning.


I belive I am doing something really really wrong like accesing the texture
inside the same camera that renders it each frame... Please any comment
would be very helpful.
Thanks!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problems when rendering to a FBO texture and using that as a texture.

2007-10-08 Thread David Callu
Hi Alberto,

  The strange thing is OpenGL FrameBufferObject extension don't use the
windowing-api
  so the wglBindTextureImageARB have not to be called.


  your code seem to be good.

  take a look to osgprerender example.
  osgprerender --fbo use frame buffer object.

HTH
David

2007/10/8, Alberto Nortes [EMAIL PROTECTED]:

 Hi!,

 We have migrated all the code to the new osgViewer and everything is
 working marvelously, but:
 In OSG-2.2, with an Nvidia 7800 GT, I create an FBO to render the scene to
 a texture, this works correctly, but later if I want to use that texture as
 an input I get the following error:

 PixelBufferWin32::wglBindTexImageARB(), failed

 This used to work while working with osgProducer, but right now I dont
 know what can be wrong. Here is some code:

 //Render the current scene to a texture.
 camera-setRenderOrder(osg::CameraNode::PRE_RENDER);
 camera-setRenderTargetImplementation(osg::CameraNode::FRAME_BUFFER_OBJECT);

 camera-attach(osg::CameraNode::COLOR_BUFFER, _texture_fbo);
 camera-addChild(*_total_root*);

 _root_camera_fbo-addChild(camera);
 _root_camera_fbo-addChild(nested_quad_from_camera);
 viewer.setSceneData(_root_camera_fbo);

 //Then in another part of the code I do:
 osg::Texture2D* _imagen_fbo = getTextureFbo();
 *_total_root*-addChild(group);
 group-getOrCreateStateset()-setTextureAttributeAndModes(0,
 _imagen_fbo,osg::StateAttribute::ON); //This last line provokes the warning.


 I belive I am doing something really really wrong like accesing the
 texture inside the same camera that renders it each frame... Please any
 comment would be very helpful.
 Thanks!
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org