I’m writing a basic planet viewer OpenGL Perl application, just for fun. I have the basics working, with the glorious planet, implemented through a gluSphere(), rotating with the classic earth texture map applied.
Now, what if I want to apply a second texture map through OpenGL (say, the ‘earth clouds’)?
Of course, I can mix the two texture maps myself in PhotoShop or some other graphic application, but is there a way through OpenGL API?
I tried loading the two textures and generating the mipmaps but the planet is shown with only the first texture applied, not the second.
As Jim Buck said, you can get the desired effect with multitexturing.
However, I don’t think the GLU quadrics support multitexture coordinate generation (i.e. using glMultiTexCoord*() vs. glTexCoord*(). So, I think you’ll need your own sphere code to go the multitexture route.
Alternatively, you might be able to get away with drawing a slightly bigger sphere around your current one that has the second texture map on it (with appropriate use of the alpha channel & blending). This is likely to cause z-fighting though, so it may be more trouble than it’s worth.
Writing your own sphere code isn’t hard–probably the easiest route to get satisfactory results.