View Full Version : How does OpenGL rasterize pixels?
shapeare
04-10-2012, 08:42 PM
I drew a pixel with color (0.5, 0.5, 0)at window location (357.2, 255.5) and then use glReadPixels() to read the pixel values from the following four locaitons, they are with their respective colors:
(357, 255), (0.36, 0.36, 0)
(358, 255), (0.255, 0.255, 0)
(357, 256), (0.36, 0.36, 0)
(358, 256), (0.255, 0.255, 0)
How does OpenGL rasterize to result in those color values?
tonyo_au
04-10-2012, 10:46 PM
Are you using MSAA
shapeare
04-10-2012, 10:58 PM
Yes. But if I do not use it, I only get (0.49, 0.49, 0) at (357, 256). All the other locations are 0;
tonyo_au
04-11-2012, 12:01 AM
That sounds about right. The .49 will just be rounding errors - this makes interesting reading
http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
With MSAA only some samples of the fragment at set - at (358, 255), (0.255, 0.255, 0) about half the fragment is covered. So this results in the screen pixel value.
What samples are set depends on the driver, the graphics card and the anti-aliasing chosen (MSAA, CSAA, FXAA - probably others)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.