Re: [osg-users] Read texels from texture in GPU memory

2010-06-17 Thread Martin Aasen
Hi again, I appologize in advance for asking stupid questions;) By changing the line cam-setRenderOrder(osg::Camera::PRE_RENDER); to cam-setRenderOrder(osg::Camera::POST_RENDER); everything works as expected (src in my previous post). I have the following questions: 1: Is this correct

Re: [osg-users] Read texels from texture in GPU memory

2010-06-10 Thread Martin Aasen
OK, this is what I've done. I've Subclassed osg::Camera::DrawCallback and read from the texture in the operator() using osg::Image::readPixels, with an applied FBO with the texture i want to read from attached. The retrieved value seems to be correct. The callback object is set as final draw

[osg-users] Read texels from texture in GPU memory

2010-06-09 Thread Martin Aasen
Hi all! I am currently rendering to a texture by attaching it to a camera as Camera::COLOR_BUFFER. Now I want to read data back to the CPU from this texture. I have looked at the examples and examined the forum, but I still don't understand how to do this. Can anyone please point me to the

Re: [osg-users] Read texels from texture in GPU memory

2010-06-09 Thread Tomlinson, Gordon
- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Martin Aasen Sent: Wednesday, June 09, 2010 9:33 AM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Read texels from texture in GPU memory Hi all! I am currently

Re: [osg-users] Read texels from texture in GPU memory

2010-06-09 Thread Frederic Bouvier
Hi Martin, you can look at the osgprerender example when use_image is set. You attach an image to the camera and read the image data in a postdraw callback -Fred - Martin Aasen a écrit : Hi all! I am currently rendering to a texture by attaching it to a camera as

Re: [osg-users] Read texels from texture in GPU memory

2010-06-09 Thread Martin Aasen
Hi, Thanks for the replies, guys! I think we are on to something, but I have to make myself a bit more clear. What I want is a function like float getSample(Texture2D* tex, Vec2 pos), which will return the float value stored in tex at pos (tex is a float 32 texture with one component) on

Re: [osg-users] Read texels from texture in GPU memory

2010-06-09 Thread Frederic Bouvier
As far as I can tell, glGetTexImage retrieve the whole texture data. If you want to read a subset of that, you'll have to read the framebuffer object with glReadBuffer/glReadPixels as suggested by Gordon. -Fred - Martin Aasen martin-ferstad.aa...@ffi.no a écrit : Hi, Thanks for the