glClearcolor() problem : I am not sure ??

Hi,

My problem is when i am trying to change the background color in run time, i want to call the display function two times to made the color change.I am using Opengl with MFC.For color selection i used the standard windows color dialog.I am getting the correct values from the color dialog and the that same values in the glClearcolor() function’s arguments also.But i need to call the display function two times.The function call is given below:-

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glClearColor(m_nRBackgroundColor,m_nGBackgroundColor,m_nBBackgroundColor,1);

What is the problem ? How i can solve this ? If any buffer clearing problem ?

Thanks for any input,

Jerry

Change the order of the two statements: first set the color, then call clear…

HTH

Yes it is working well !.
Thank U very much.
My knowledge was that first clear the buffer and after that specify the color to clear the background.Now i got the correct way.

Thank u once again

Jerry