views:

48

answers:

1

I'm getting started with OpenGL ES on Android and I'd looking to learn some techniques to have a game map larger than the visible area.

I'm assuming I've somehow got to ensure that the system isn't rendering the entire scene, including what's outside of the visible area. I'm just not sure how I'd go about designing this!

This is for simple 2D top-down tile based rendering. No real 3D except what's inherent in OpenGL ES itself.

Would anyone be able to get me started on the right path? Are there options that might scale nicely when I decide to start tilting my perspective and doing 3D?

+1  A: 

There are many, MANY techniques for accomplishing this goal, but the base idea of what you are looking for is called Frustum Culling, that is not drawing anything the user isn't going to see anyway. Here and here are a couple of tutorials on how this works.

CaseyB
As I'm working in OpenGL ES, a few of the methods are missing, but there is glFrustumf. I'm wondering, would this perhaps make the task easier when it comes to rendering?
Omega
It's most common to set up your frustum using GLU, it makes it easier, so you don't need to use `glFrustum()`. It won't really make it easier, it will make it faster.
CaseyB
Bit by bit, I'm piecing all of this together. It doesn't help that I'm also having to flash-learn some calculus.That said, having a context in which to pick up the concepts has made it pretty easy.Thanks so much for your help. I think I understand the thinking and implementation behind frustums. 6 sides, if a single point of an object is within those bounds, render it.
Omega
I should add that I also saw some discussions regarding not simply scanning all your objects to check the frustum. In some cases you may be able to selectively eliminate them.In my case, I don't think it applies as I'm doing a kind of chessboard-style user interface.
Omega