-
Counting pixels
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?
-
Member
Regular Contributor
Re: Counting pixels
You could try occlusion queries. Take a look at ARB_occlusion_query.
-
Re: Counting pixels
If its 2d, look into glReadPixels for copying to mainboard ram where you can count the pixels.
-
Advanced Member
Frequent Contributor
Re: Counting pixels
you could use Shadow Volumes to render to the
stencil buffer.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules