PDA

View Full Version : area calculation



nm
08-04-2005, 05:38 AM
Hello, :confused:
Please help me.
I draw a complicated figure such as a map by gluTessBeginPolygon in the XY plane.
I want to get the area of the sub region on the map.
So I copied the image of the sub region into main memory by glutReadPixels and I counted the pixel value.
By this method, I could count the area of the sub region of the map.
However, I want to get a lot of other sub region's area of the map.
Is there a faster method to get the area of the drawing image?

Hlz
08-04-2005, 08:49 AM
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt

nm
08-05-2005, 05:11 AM
Hello Hlz,
Thank you very much.
By your suggestion, I could get the are of image very faster by ARB_occlusion_query method.
My program became ten times faster.

I have an additional question.
Can I use ARB_occlusion_query with off-screen window?
I found a good sample of ARB_occlusion_query,

http://www.codesampler.com/source/ogl_occlusion_query_arb.zip

and I tried to make window invisible but I could not do that.

Please give me hint.

Aeluned
08-05-2005, 07:39 AM
You need to render to an offscreen rendering context not an occluded or invisible window.

The problem is that occluded (or invisible) areas of the render buffer produce undefined values when rendered to.

Use a PBuffer (or better yet an FBO if your graphics card supports it). You should then have no problem using occlusion queries.

nm
08-09-2005, 05:59 PM
Hello,
I could use ARB_occlusion_query with PBuffer.
This is what I want to do!
Thank you very much.