I'm wondering if opengl can automatically manage offscreen rendering. I mean if it can detect and ignore sprites and textures if they are rendered out of screen.
if it makes any difference i'm targeting opengl-es 2.
I'm wondering if opengl can automatically manage offscreen rendering. I mean if it can detect and ignore sprites and textures if they are rendered out of screen. if it makes any difference i'm targeting opengl-es 2. |
||||
|
To bind a texture in OpenGL-ES 2.0, the texture must be in memory. Whether or not the texture gets used depends on whether an object remaining in the viewable scene uses that texture. So, yes, it can ignore the texture for rasterization, however, to your point of a 2048x2048 texture on a 480x320 screen, as the Apple "OpenGL ES Programming Guide for iOS" states on page 71:
And on page 72:
You can apply the same logic to most OpenGL-ES 2.0 devices, since they each have limited memory. |
||||
Did this answer by Paul help you? It's easy to give back. Sign up to get started. | ||||
|
If an object, when translated to the 2D display, is not within the buffer's dimensions then OpnGL will do nothing with the data.. However it still has to do a bit of processing to get to that point so it is still considered better practice to only send things to OpenGL that actually have a chance of being seen on the screen in one manner or another. Scene Graphs are the constructs that are commonly used to determine which objects to send down the graphics pipeline for processing or not. Hope this helps. |
|||||||||||||||||||||
|
In general, if you're thinking solely in terms of 2D graphics, "sprites and textures", rendering performance is not going to be a concern. Not on any hardware you can actually have bought in the last 8 years. You might be drawing, what, a few hundred quads every frame? Maybe a thousand, tops? You could do that on a Voodoo 1 at 60fps no problem, and that was with software T&L. You don't need to concern yourself too much with parts of quads that happen to be off-screen. GPUs aren't stupid; they will not do work that will not have a visible effect. Remember: hardware makers make money based on how fast their cards go. And spending time on the part of a triangle that's off-screen is time that could have gone to stuff that's on-screen. Now, that being said, it's not a bad idea to do some simple visibility checks to see if a quad is actually on screen or not. But the key word is "simple". At no time should you modify a quad so that you're only rendering the visible portion; just let the GPU do its job. |
|||
|