converting a world map texture to a mercator map

I have texture mapped a openGL window with a world map. Now I want to convert the world map texture to a mercator projection world map and perform the calculations for the same using c++ and Visual studio 2005 .

Your world map texture is likely one of two things: a 2D texture or a cubemap.

If it’s a cubemap, then you basically just need to use a form of spherical coordinates. The rho and theta are your positions on your flat surface. Convert them into vector directions and access your cubemap.

If your world map texture is a 2D texture, then odds are it’s already a mercator projection, as that’s the simplest kind of sphere-to-2D projection to map to a sphere. If it isn’t, we would need to see the texture to know how to map it.

Not sure what you mean by this? Do you have a flat map, a spherical map, or neither?

I want to convert the world map texture to a mercator projection world map …
Do you really want Mercator? Mercator projections severely distend land masses towards the poles and don’t even include the poles. I see them used often and can’t figure out why? They are mathematically more complicated to use then a simple Cartesian flat map which shows the entire earth. I’ve attached a screen grab of an OGL sim I’m working on now. It demonstrates both spherical and Cartesian projections. The Cartesian projection (flat map) is not done with texture mapping. It’s done with glDrawPixels. When you say you have ‘texture mapped’ a world map, do you mean one of the projections below?