pouët.net

Geting a point on a buffer!

category: gfx [glöplog]
 
I want an easy way to get a single pixel / texel from a buffer to get an object id stored in a stencil buffer or an integer buffer. What's the fastest way to do that using OpenGL? I'm thinking in setting up a pixel buffer and read it using glReadPixels, as it's faster than glReadPixels, the only thing that came to my mind.
added on the 2011-03-11 15:10:57 by xernobyl xernobyl
dunno if i got you correctly, but wouldn't be occlusion queries another option for what you potentially want to do?
added on the 2011-03-11 17:02:37 by prost prost
??
http://www.opengl.org/wiki/Common_Mistakes#Selection_and_Picking_and_Feedback_Mode
added on the 2011-03-11 17:09:05 by Orace Orace
pro: I don't know much about occlusion queries. I just know that they return the number of pixels written, which is good for a multipass architecture. I don't know anything else about them really.

Orace: that helped... now I know how it's called ;)

It seems everyone uses glReadPixels, without pixel buffers.
added on the 2011-03-11 17:53:37 by xernobyl xernobyl
pro: I don't know much about occlusion queries. I just know that they return the number of pixels written, which is good for a multipass architecture. I don't know anything else about them really.

Orace: that helped... now I know how it's called ;)

It seems everyone uses glReadPixels, without pixel buffers.
added on the 2011-03-11 17:53:38 by xernobyl xernobyl
I've seen people triple buffer their readbacks using multiple pixel buffer.
The glGetBufferSubData would happen 2/3 frames after the glPixelRead.
However I don't know if it was actually useful.
added on the 2011-03-11 19:12:33 by ponce ponce
AFAIK, Picking & Selection are NOT supported in hardware, so I wouldn't suggest using them.

link
added on the 2011-03-11 19:21:45 by AGL AGL
Oops, same link as Orace
added on the 2011-03-11 19:22:57 by AGL AGL
xernobyl: you're right. occlusion queries return the number of fragments that got rendered. if you want to do picking, this is not a suitable option...

occlusion queries normally stall your pipeline since you have to wait until the result is ready. while it helps killing some gpu/cpu synch problems i had once back at work it requires some more work if you don't wait for them to return and simply get the result in the next frame. this, however, could theoretically lead to artefacts if you have fast moving objects. practically, this never happened.

it would only make sense if you want to speed up your rendering by checking at first if something is available at all (via an occquery) - and then do glReadPixels afterwards only if your occlusion test object doesn't fail. but make sure it's cheaper to do an occlusion test instead of calling glReadPixels. I guess this depends on what you want to do....
added on the 2011-03-11 21:33:49 by prost prost

login