Does anyone know of a way to find all visible primitives in a frame? Any suggestions would be welcome.
Currently, I have a method to find out which primitive is visible at a given pixel (x,y) in the viewport, which I use for picking/selection. The method relies on drawing to a 1-pixel selection region and examining hit records to see which primitives in the selection region have the smallest z- window coordinates.
Unfortunately, the method seems to be slow for using in a loop such as the one below:
for (i = 0; i < w; i++)
for (j = 0; j < h; j++)
// get closest primitive
// insert primitive into a container
Is there a faster way to find which primitives are visible?