Jump to content
  • Advertisement
Sign in to follow this  
dsr12

OpenGL displaying countries on a globe

This topic is 3705 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am making a homemade "geo-political simulator" that naturally involves a globe textured with photos of the earth for visualizations. Not that it should matter for my question, but I am doing this in java opengl. I am having difficulty deciding how to approach certain graphical things given these two constraints: 1) It will be necessary to render the globe while highlighting the territories of various countries in false color. (like shading territory of enemies and allies) 2) Country borders can change in an almost "continuous" coordinate system. By this, I mean that I am trying not to designate large geographic "regions" that countries can lose and acquire (like the board game "Risk"). Rather, the "earth" has a resolution of 16384x8192 pixels and I would like have countries gain and lose the equivalents of pixels. I have first considered maintaining a giant array of values corresponding to the ownership of each pixel, but I do not know how I could get the country highlighting to work without subdividing my globe into tiny pixel-size divisions to color as the globe is rendered. This approach would be very easy to manage, but is this even practical given my massive detail of 16384x8192? My other idea was to store values for the points that define the borders of countries and construct country-shaped polygons that can be overlaid on the globe. This allows for easy highlighting, but I would imagine it would get out of hand for dynamic borders that can possibly fail to be simply connected. Your thoughts on my problem would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
How about having a texture that covers your globe and paint the borders dynamically on that texture? Then the globe can be any resolution you like. Mapping between the spherical coordinates on the globe, and flat coordinates on the texture is not trivial, but cartographers have been doing it for a long time. [smile]

Share this post


Link to post
Share on other sites
I think the polygon idea is the best way to go. It will be very low cost memory wise since you are only keeping track of the border points, and a country must have a closed shape by definition of a country border!

You could try to use some uniformly spaced vertices around the border, and then if the border changes due to a war or whatever, then push the vertices into the new direction until the change in property is satisfied. This way you could also show the animation of the borders moving - which would be impossible with the texture approach.

That's just my take on it - but I think you'll be happy with the polygon approach.

Share this post


Link to post
Share on other sites
How about this one:

You have your normal, textured globe, showing the land and sea. Over that you create a thin shell of voxels. Each voxel can then be made semi-transparent and colored according to what country currently posses that particular bit of land.

With LOD and some clever culling I think it could be pretty fast, so you could get a good resolution of the voxels.

Share this post


Link to post
Share on other sites
Promethium (1st post): In terms of performance, do you know how feasible it is to "paint" a texture (or set of textures) equivalent to 16384x8192? I think I can store the ownership of each "pixel" on the earth in a list of bytes using basic RLE compression to hopefully never be more than 5MB in the system memory. This is where I would store the data on how to paint the texture. If I were to highlight all allies of a player's country, I would need to go through my list of data to determine which pixels need to be shaded. I would imagine this isn't practical given the amount of data to process to make that texture.

Jason: I think this is how I am leaning at the moment, and after further thought I think it would actually be just slightly more difficult than the "brute force" approach for keeping track of each pixel. However, I am trying to get all my options identified because this technique would mean sacrificing a key feature that I wanted to implement in this simulation. That is, having one's control over territory be expressed as a value in additional to whether they control it or not. On fronts in a war, political boundaries on a map mean nothing and I wanted to express ownership with values depending on their military presence. To implement, I would need to keep track of the current "owner" and their level of control.

Promethium (2nd post): I don't know anything about voxels, but from what I have read I don't see the advantages of doing this.

Thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!