PDA

View Full Version : Detect if viewport is onscreen?



xtr33me
11-02-2012, 06:30 AM
Is there any way to be able to query the GPU to tell me if my viewport in my webpage is currently on screen or not? For example, if I had a 3d scene rendering in a canvas in an iframe, is there a way to query the hardware (within my iframe and only the pixels or verts in the viewport) to say if I am on screen or scrolled off screen? I thought that the hardware would be smart enough to only render what is currently on screen and Im currently trying to come up with some way of possibly doing this in a vertex shader. Any possible ideas? Is this even possible? Thanks!