Sign in to follow this  
Keyframe

OpenGL Infinite or semi-infinite grid

Recommended Posts

I want to make an infinite ortographic grid (or a very large distance number, of course). Since I'm kind of rusty on OpenGL (and DirectX) I made a prototype with immediate mode in OpenGL. Not that it has to do anything with API of course. As you can see on the picture, I have a world 0,0 marked with bolder lines, and every fifth unit is marked - while regular units are normal width. I want to be able to pan through the world in infinite kind of fashion, if you know what I mean - so that center is where world center belongs to, etc. I suspect I need to represent my world first in a grid fashion and then draw it to the screen, but what happens if I want to have semi-infinite state of the world grid? Do I just assign long,long to the coordinates and be happy with that and if I ever come to the end of the world I wrap around? Also, how would I approach multi-resolution grid? That is, if I want to zoom in on the grid, I want to display finer level of units - say if I want to zoom in on one unit, it should display another five units of granulation, and so on - untill I get to a certain treshold. Anyways, what kind of data structures should I look into and how should I draw it out? Immediate mode here is just a prototype, a hack. As I'm aware, retained mode is what I should look into for production level. Grid prototype

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this