• Create Account

### #Actualfear4ever

Posted 02 August 2012 - 12:26 AM

nvm

### #1fear4ever

Posted 04 July 2012 - 02:15 AM

Hi,

Not sure if the opengl forum is the right place to ask this but here we go.

I am thinking about implementing a google maps like program with c and opengl.
Assume i have a large world texture for different zoom levels (better yet many small rectangular textures that make up the earth, each has a lower left corner and upper right corner, every column in the texture is known to belong to the same longitude, same for the rows and latitudes)

The problem is painting the screen with the correct colors obtained from the textures based on their respective coordinates.

Now since this is a mapping application, map datum and projection comes into place.
http://egsc.usgs.gov...rojections.html

Google maps use WGS84 datum and Mercator projection. (And as far as i can see it cant be rotated). Mercator (or most cylindrical projections) have a simplifying property. Projected maps have the same longitude along the same pixel columns. This matches the underlying data model so this method works:
1 - Calculate screen boundaries
2 - Fetch any map tiles intersected/contained by the bounding box
3 - Draw the tiles as quads

What i have in mind is to implement some non cylindrical projection that can be rotated. Say gnomic or Lambert Conformal Conic.
Now the screen boundary is not rectangular so a bounding box cannot be easily calculated. And since the projection is not rectangular, we cant just draw quads on the screen matching the data tiles.

Assume i have the means the convert between screen coordinates and the selected map projection (given a longitude/latitude i can find where on the user screen that is, given a point on user screen i can calculate the longitude/latitude of that point)

Brute force would be
for each pixel on screen
find real world coordinates
find the tile containing said coordinate
find the pixel in that tile corresponding to that coordinate
fill that pixel with the obtained color
end

Of course that will be very slow, so useless from an interaction point of view

What would be the best (need interactive speeds) to implement such a system?
Any input would be appreciated

PARTNERS