detect write to (depth-)buffer


I want to do the following:

  1. render some object
  2. check if something is drawn

One soultion I could imagine, is to use a stencil buffer:

  1. clear/enable stencil buffer (ALWAYS)
  2. render some object
  3. iterate through stencil buffer and check if a write happened

this seems to be too expensive, because I just want to know IF something was drawn and not WHERE.

Is there some kind of flag with which I can do the following:

  1. set write flag to FALSE
  2. render some object
  3. check if write flag is set


That’s what GL occlusion queries are for.

thank you… it worked!! :slight_smile:
Is it good practice to use this method for occlusion culling?