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.


3 Answers 3


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:

Reduce Texture Memory Usage

Reducing the amount of memory your iOS application uses is always an important part of tuning your application. However, an OpenGL ES application is also constrained in the total amount of memory it can use to load textures.

And on page 72:

Use Properly Sized Textures

The images that an iOS-based device displays are very small. Your application does not need to provide large textures to present acceptable images to the screen. Halving both dimensions of a texture reduces the amount of memory needed for that texture to one-quarter that of the original texture.

Before shrinking your textures, attempt to compress the texture or use a lower-precision color format first. A texture compressed with the PVRTC format usually provides higher image quality than shrinking the texture—and it uses less memory too!

You can apply the same logic to most OpenGL-ES 2.0 devices, since they each have limited memory.


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.

  • \$\begingroup\$ I'm wondering what would happen if I've got an object let's say 2048x2048 pixels, while my render output is a 480x320 display. should I clip texture or can I rely on opengl to skip rendering in offscreen spaces? \$\endgroup\$
    – Ali1S232
    Commented Sep 14, 2011 at 18:07
  • \$\begingroup\$ Any manual culling you attempt to do would only be to try and avoid the overhead of state changes, draw calls, and other application-side processing. Otherwise, the graphics hardware is probably going to be much better at clipping triangles than anything you can do at the app level. \$\endgroup\$
    – Zach
    Commented Sep 14, 2011 at 18:30
  • \$\begingroup\$ Ah, when its an object as large as that, and you know 480x320 of it will be rendered then yes, it will only spend the time 'copying' the part that is seen and ignore the rest, once its determined what that is. I would suggest however breaking the large ?texture? up into 256x256 blocks and then send whatever combination of 4 of them would actually be needed. \$\endgroup\$
    – James
    Commented Sep 14, 2011 at 18:34
  • 1
    \$\begingroup\$ @James: I disagree with James's suggestion of breaking the texture into 256x256 blocks. Unless you are targeting ancient hardware, there's no need to. It would increase the complexity of your rendering logic for no measurable gain. \$\endgroup\$ Commented Sep 14, 2011 at 18:55
  • \$\begingroup\$ @Nicol Bolas The target is a portable device of some kind (OpenGL ES2). Now I think its pretty spiffy how powerful and capable they are, but they are not known for high speed bandwidth buses for data transfer. sending 327680 instead of 4194304 bytes to render 153600 of them is going to be faster no matter which way you look at it. \$\endgroup\$
    – James
    Commented Sep 14, 2011 at 19:01

I mean if it can detect and ignore sprites and textures if they are rendered out of screen.

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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .