View Full Version : Counting pixels
07-17-2005, 02:06 PM
how do i count pixels? i am trying to calculate the projected area of a complex solid and it was recomended to count the number of pixels and compare it to an image of known size. any idea how to do this?
07-17-2005, 02:19 PM
You could try occlusion queries. Take a look at ARB_occlusion_query.
07-17-2005, 04:26 PM
If its 2d, look into glReadPixels for copying to mainboard ram where you can count the pixels.
07-18-2005, 12:36 AM
you could use Shadow Volumes (http://developer.nvidia.com/object/cedec_stencil.html) to render to the
with this technique you divide your solid into
polygons and render a shadow volume for each of
them to the stencil buffer. afterwards the stencil
buffer bits are 1 for each pixel, which is in the
shadow of the polygon.
i know it's a bit complicated, but you could
even use it to project an arbitrary solid onto
an arbitrarily curved surface.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.