On Saturday 01 February 2003 06:22 pm, Lars Olson wrote:
> Correction:  I just looked up the function prototype (found one at 
> http://www.cevis.uni-bremen.de/~uwe/opengl/glReadPixels.html, google 
> returned several others) and if you use GL_RGB (or GL_RGBA) it will 
> return all the color components.
> 
> e.g.:
>       float rgb[3];
>       glReadPixels(x, y, 1, 1, GL_RGB, GL_FLOAT, rgb);
> 
> One caveat:  as I recall, you actually had to flush the buffer before it 
> would read correctly, otherwise it would always return (0,0,0) (black). 
>   This caused my floodfill to be extreeeeemely slow.  The wrapper 
> function idea would definitely work faster.  (Anyone know if there's a 
> way to check the frame buffer without having to redraw the screen?)

Disclaimer - I have very little experience with OpenGL, this answer is based 
just on a little bit of common sense.

It seems to me that glReadPixels() will read the entire polygon into an 
array. Assuming I am right, then a good strategy for floodfill should be to 
call glReadPixels() on the rectangle that covers the area you are trying to 
floodfill, then perform the floodfill in memory on the array you have read, 
and then call glWritePixels() to send it back to the screen.

-- 
MySQL Development Team
For technical support contracts, visit https://order.mysql.com/?ref=mspa
   __  ___     ___ ____  __ 
  /  |/  /_ __/ __/ __ \/ /   Sasha Pachev <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, http://www.mysql.com/
/_/  /_/\_, /___/\___\_\___/  Provo, Utah, USA
       <___/                  

MySQL Users Conference and Expo
http://www.mysql.com/events/uc2003/

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to