View Full Version : Write object space coordinates during rendering?

01-27-2004, 02: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?

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

01-27-2004, 03: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?

01-27-2004, 04: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

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

Christian Schüler
01-28-2004, 07: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.