ahn wrote
Hi. I am trying to implement the Earth model.
I am trying to map earth texture on a sphere.
I have two different textures one is a texture of the Earth and the other is a texture about night light of the earth.
So I need to map the texture together on a sphere depend on where the light come from.
(if it faces to light then normal texture opposite side is night light texture)
As I am newbie to JOGL and I am studying by myself not easy find out the way how to solve..
Could anybody comment how to solve on this??
(I guess, I can solve it by blending the two picture or something?)
You should work through :
http://www.arcsynthesis.org/gltut/It is a good tutorial on shader based OpenGL. OpenGL is not easy, it takes a lot of learning to get started so you should be prepared to spend a lot of time with this.
In your case I would: make a triangle mesh based on a sphere, perhaps an icosphere like this:
http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html and also calculate vertex normals for each vertex.
Armed with vertex normals for a triangle mesh your shader can can have two textures and calculate the angle (dot-product) between the light and the vertex normal to blend the day/light textures. It should be a calculation similar to Gouraud-shading
http://en.wikipedia.org/wiki/Gouraud_shading