Why can i only query how many pixels actually got drawn? Wouldn´t it be extremely helpful, if the driver also told me how many fragments were generated and tested?
For example: I´d like to scale the intensity of a light-flare depending on how visible the flare is.
Now the occlusion query tells me, that 100 pixels were drawn. That doesn´t help me much. If it also told me, that the object potentially covers 100000 pixels (considering the distance and size of the object), but only those 100 passed all test, then i would know much better how to scale the intensity.
I´m not a driver-writer, so i don´t know if this is a hard thing to do. However i hope someone considers this as an addition in future extensions.
Cant you work it out yourself? Just project the top left and bottom right corners of the quad, and convert to pixel coordinates via the window dimensions, and you can easily work out how many pixels it would have covered.
I am sorry, i don´t think i can work it out myself. Well, maybe if i think some hours about it and test some code, then i might find a solution.
I am programming for some years now, but 3D graphics is still quite new for me (i am doing this seriously for one and a half year now).
The thing is, that i have so much of things i like to do, and even more things i need to do (to get to the stuff i like to do), that i don´t really want to do EVERYTHING by myself.
So sorry, that i am bothering you with stuff, that seems to be easy for you.
My comment was not meant to sound harsh. It wasn’t an attack on your abilities, more a question as to weather you could rely on a software approach.
Sorry if my reply offended, it was not meant to.
Ok, no problem. I was just a bit angry, cause i know your homepage and your programs, and when i look at them, i know, that i still have to learn a lot. And if someone like you then tells me, that it´s all so easy and i should not ask such dumb questions, then i think you forgot, that there was a time, when you didn´t know all that stuff, too.
To your question: For me it would make no difference, whether i use a software solution or the Occlusion Query. A software approach would even be better (no pipeline stall). But for the moment i think my approach is ok.
I meant just a software approach for working out the amount of pixel coverage what you’re occluding could potentially cover.
Still use the hardware occlusion query, which tells you how many fragments passed.
Then use that against the value you calculated as a percentage occluded value.
If you plan to go far then you should take the time to learn some basic matrix maths. You should know how coordinates you give get transformed to screen space, you’re going to need to know to do a lot of stuff - it’s worth taking the time.
The OpenGL spec will explain the entire process clearly.