1

I am trying to write a sample opengl application for occlusion query to identify visible triangles. But occlusion query always returns zero count for pixel sampling.

I follow below steps to do so:

  1. Setup opengl\glut

  2. Call lookat from a point (from where complete model is visible)

  3. Enable depth test, depth mask, enable face culling ( and few other options).
  4. Render complete model.
  5. Disable depth mask
  6. Start new occlusion query
  7. Render a triangle \ face
  8. End query and wait until result is available.
  9. Once result is available then get count.
  10. Repeat step 6 to 9 for all triangles \ faces.

For given model I compute bbox and enlarge it by some factor (say 1.5) so as complete model is visible. From each corner of bbox, I call step 2-10 and with eye point as corner.

Here issue is for each query result of step #9 (output of occlusion ) query is 0, i.e. it is stating number of visible pixel are zero.

I have attached sample application here (ObjRender Sample) which loads OBJ file and perform above step 1-10. To reproduce it just open VS project, build and run it. It has sample data with it.

varad
  • 11
  • 1

0 Answers0