As you may know the earth moves around the sun in circle. So you must move your GL-earth in a similar matter and overlap with some earth rotation.
I found this nice
example code or this
snippets which may help you to understand it.
Hint: the OpenGL is highly portable, so you should find the interesting parts