PDA

View Full Version : framebuffer reading and re-coloring pixels



lua
05-09-2005, 03:03 AM
hi, all
i just wanna read all the pixels from a image in the scence fragment by fragment through framebuffer, then re-coloring pixels which i am interested in. Now i know how to read pixels by using glReadPixels() from a frame buffer, my questinon is how to modify those pixels' information, for example, the depth value, the color and so on, and when i recolor all the fragment, does the image lose the realistic feeling? And the second question: whether using cg language is more efficient and easy implementable?

Big thanks

CWiC
05-09-2005, 03:30 AM
Consider using of glWritePixels after fragments modification.
As for Cg - it's depends on how complex scheme of your color and depth changes, if it can be writen in Cg program than you'll get big win in performance as glRead/WritePixels not designed in speed in mind.

lua
05-15-2005, 06:34 PM
thx
but it seems that, unfortunately, there is not a a OpenGL function named " glWritePixels". Is it a ARB function supported only by the latest OpenGL version? My familiar OpenGL version is 1.2 .

i wanna use mouse to scan the whole image and pick all the pixels which the mouse have just catched and then read those pixels' z-buffer , reverse the pipeline , get the corresponding 3d vertex coordinates, and using this corrdinates value to lookup a color-table which i presumbly set, then change the pixel color at last.

will this algorithm be work?