I’m sure there’s probably a simple (and fast) solution to this, but:
I’ve been trying to determine if a point light source is visible to the viewer. The simplest way to do this seemed to be to obtain the window coordinates of the light source and compare the depth buffer value after rendering all other objects with the z-value of the light source. I’ve been using glReadPixels(…GL_DEPTH_COMPONENT…) to find the z value of a point on the window, but unfortunately, this call kills the frame rate in my application.
Can anybody suggest another (fast) way of doing the light visibility test, or perhaps something that I am doing wrong ?