Why can I only see my earth for once?

When I run my program compiled in visual C++6.0,I can only see my earth the first time the following function is called.
In my program, I make a ActiveX control in which OpenGL is used to draw a earth. The function to draw the earth is called every 1 second when a WM_TIMER message is triggered.
Can anyone tell me why and how to solve the problem? Eager for your help!
void OnTimer(UINT nIDEvent)
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
RenderEarthScene();
glFlush();
SwapBuffers(hdc);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
COleControl::OnTimer(nIDEvent);
}

Originally posted by jiangerlai:
The function to draw the earth is called every 1 second when a WM_TIMER message is triggered.

I don’t know anything about ActiveX or windows coding in general but to me it seems not to be a good idea to call your draw function only once a second (this would be 1 frame per sec). You should try to draw your earth model everytime your display is refreshed. And I don’t understand why you set your modelview matrix to identity after the buffer swap.

hih

[This message has been edited by satan (edited 03-15-2003).]

I want to make my earth rotate.It starts from the identity matrix every time I draw it.
I set the timer to a small value,but it still doesn’t work.

Originally posted by jiangerlai:
I want to make my earth rotate.It starts from the identity matrix every time I draw it.
I set the timer to a small value,but it still doesn’t work.

I don’t hink that I can be of any help, sorry. But what I meant was not reducing the intervall of the timer but not using any timer at all for displaying but as stated in my last post calling the display function every time your window will be redrawn and using the timer just for the animation part. I think the people more familiar with windows can offer help here but they need more info. The code you gave looks correct to me. You may want to check if it is a problem with you animation or model by just displaying a trinagle that will not be animated. That’s all I can say, hopefully some windows people can help you more than I can.

Try putting it between calls to BeginPaint and EndPaint. And you may need to Invalidate the entire window just before the BeginPaint.

Thanks anyway.I will try your suggestions.
Gook luck!