PDA

View Full Version : Write object space coordinates during rendering?



Bagoj
01-27-2004, 03:35 PM
Hi there!

Someone please could tell me if it is possible to render a frame but to write the object space coordinates of the rendered point into a buffer instead of writing color information? Is it possible using some buffer or setting or anything?

Thanks!
p.s.: Sorry my english is not correct http://www.opengl.org/discussion_boards/ubb/frown.gif

endash
01-27-2004, 04:44 PM
You should be able to do this fairly easily using a fragment program. It will be to the effect of MOV result.color, fragment.position; Only you may have to project the position back into space. (I forget which space fragment.position is in.) Be sure blending is off.

If I might ask, why do you need an image of the positions of things?

Bagoj
01-27-2004, 05:54 PM
Well not the image is important just to get object space coords by some easy way http://www.opengl.org/discussion_boards/ubb/smile.gif

I've made it now reading the depth buffer, it's almost what i want just i have to calculate the other two coords with gluunproject. (I thought it would be easy to render a small portion of the screen and just read the corresponding "pixel" containing all 3 coords.)
By the way thanks for your reply! http://www.opengl.org/discussion_boards/ubb/smile.gif

AdrianD
01-28-2004, 06:24 AM
try using float-textures as rendering target.
(if you can live with missing alpha-blending)

Christian Schüler
01-28-2004, 08:33 AM
Maybe you want to read about the GL_FEEDBACK render mode. I never used it but it sounds like what you are looking for.