PDA

View Full Version : Finding a Pixel Color



02-01-2003, 12:03 PM
I am new at this and am trying to implement a soft fill algorithm but don't know how to find the color of a pixel with openGL. Can anyone point me to a method that will return the color of an x,y,z coordinate?

Thanks,
John

nexusone
02-01-2003, 12:12 PM
OpenGL is not strong on 2D operations, you could use glReadPixels.

What are you trying to do in more detail?
There maybe a better way to do what you want with basic openGL commands.



Originally posted by hjuan99:
I am new at this and am trying to implement a soft fill algorithm but don't know how to find the color of a pixel with openGL. Can anyone point me to a method that will return the color of an x,y,z coordinate?

Thanks,
John

HS
02-01-2003, 12:55 PM
When you say "fill algo" you mean you want fill polygons yourself?

In this case I would allocate a chunk of memory and do all the rasterazation on my own. Then you can upload it to OpenGL as a texture if you have to.

OpenGL is not designed to manipulate the framebuffer on a per pixel basis with the aid of the CPU.

Yes you can read the framebuffer, manipulate one pixel and save it back but thats not really efficent (and not what OpenGL was designed for).

That would be like typing a letter, printing it, correct ONE spelling/grammar error on the printed letter, using a scanner and OCR software to get the letter back into the computer and repeat that till you have what you want..

Well you get the picture...