PDA

View Full Version : glClearcolor() problem : I am not sure ??



Axiz
09-08-2002, 07:30 PM
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_nGBackgroundCol or,m_nBBackgroundColor,1);

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

Thanks for any input,

Jerry

09-08-2002, 09:41 PM
Change the order of the two statements: first set the color, then call clear...

HTH

Axiz
09-09-2002, 02:28 AM
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