Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Counting pixels

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2005
    Location
    usa
    Posts
    3

    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?

  2. #2
    Member Regular Contributor
    Join Date
    Jan 2003
    Location
    Edmonton, Alberta, Canada
    Posts
    322

    Re: Counting pixels

    You could try occlusion queries. Take a look at ARB_occlusion_query.

  3. #3
    Intern Newbie
    Join Date
    Jun 2005
    Posts
    42

    Re: Counting pixels

    If its 2d, look into glReadPixels for copying to mainboard ram where you can count the pixels.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    664

    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
  •