Jump to content
  • Advertisement
Sign in to follow this  
mpledge52

OpenGL 3D Earth

This topic is 4023 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

Hi guys. I've just started learning some OpenGL and GLUT in C. I want to recreate something similar to google earth but instead of using photo images i'm just going to use terrain data which I've got. So basically I want to make a 3D globe. What would be the best way to go about this using OpenGL? The data I have is basically the longitude and latitude of a point, then the height above sea level at this point. This covers the whole world so is obviously quite large!! My first thought was to create a sphere to represent the Earth then put some kind of wireframe model over the surface to detail the terrain, then just add some colour. However someone has suggested that it may be better to build an algorithm to create the vertex data for a sphere manually, then it would be possible to simply alter some of the vertices individually to change the altitude. Would this be the est way to go about it? Is there any functions that would be particularly useful/I should avoid? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You can start by reading the sphere formula on wikipedia for example. But wikipedia is down at the moment, the first time ever I see that happening lol.


http://en.wikipedia.org/wiki/Sphere/

[Edited by - AIRMichael2 on September 17, 2007 9:55:03 AM]

Share this post


Link to post
Share on other sites
You'll also want to read about heightmaps :)

Other thing I am going to mention; depending on the scale you want your globe to be, you're going to run into performance considerations -- rendering the whole world at any level of detail will cripple most computers -- which brings into focus the need for dynamic levels of detail and ideas like loading data on demand (i.e. culling -- do not draw stuff people are not going to see; we can take it a little farther here and say do not even -load- the stuff until we think we need it). To start with, figure out how to make a sphere -- then figure out how much detail you want people to see -- the detail level will dictate what method you use to render the globe :)

~Shiny

p.s. if you don't believe my point about detail -- recall that google earth will load bits and pieces of the surface as it goes...keeping all that junk in memory continuously would be quite painful for your system ;)

Share this post


Link to post
Share on other sites
Thanks for your replies so far.

I realise that performance issues will play a big part in developing my program. The problem is that I'm not sure what kind performance hits I will experience and therefor what I will and wont be able to do because this is my first time programming with openGL.

First off I'll give you an idea of the data I have. At the moment I only have the data for South America, this is made up of 1807 text files, each file containing approximately 720,000 lines, each of these lines is a single point within the South America region specified by its latitude and longitude and each point has an elevation value in meters. Thats about 1.3 billion points just for South America. As you can see that is a fair amount of data and I realise I will have to cut down this data quite considerably as I would prefer to have less detail but have worldwide coverage.

The idea of this is to be a new moving map display on aircraft (you know the picture that shows you where you are on the tv's) but for it to be more interctive, i.e the passenger can zoom (to some extent) and rotate the view. Now I could quite easily limit the distance in which they could zoom out, this would allow me to limit the program to only have to load one continent at most at any one time, and to be honest, doing it this way I dont think I would even need to physically create a sphere because I'm not going to draw the whole earth in one go or from such a distance that it will be necessary.

So, so far my general outline of the program is to accept the aircraft current coords, load appropriate text files, store all this into a monster of an array, then draw the model, then slap on a bit of colour depending on the height of the point. Then i'll have to develop some kind of camera engine which can be rotated/zoomed/tilted using the keyboard controls.

Anyone have any advice on what kind of limitations I will be looking at in building this program? Or any specific functions I will need to use?

Thank you very much for any help.

Share this post


Link to post
Share on other sites
i believe google earth actually does a 3d sphere with opengl, ie it does what u want it to do.

try the following for method of texturing a sphere

www.vterrain.org
http://astronomy.swin.edu.au/%7Epbourke/index.html

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!