Tiled Terain

Hello,

I am trying to make a small overmap engine. I would be using a type of heightmap that dictates the height as well as texture to use.

I want to render it in such a way that I can control what part of the map is seen, so that the map doesn’t seem to have any edges, but seems to loop. To do this, I need to know what is visible on the screen (the width and height visible on the screen)and to be able to render what should be seen where it should be seen.

The question then is how can I tell just how much is visible on the screen when I’m not using Ortho? I’m used to exact placement that you get with ortho. But I want/need a depth look that you get with an angled camera.

If there were some way to accomplish this in ortho mode that would be much easier for me. Ether way would work though.

Any suggestions, code, tutorials, books, etc?

Thanks!
Micah

Look for “frustum culling”.
Simply assume your entire map is a box. Later you can split your map into smaller sectors to get better performance. Smallest box should have at least few hundred polygons, but few thousands polygons should be optimal, I guess.

I would try gluUnproject for each corner of the screen, then with a line going from camera to unprojected point, intersect your terrain (roughly, with altitude 0 plane for example) : it will give you max/min 2D coordinates on your height field. Enlarge a bit the selected rectangle to be sure.
http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/unproject.html