If you have problem in changing color of object in OpenGL using keyboard while running program then this article may help you.Simply we can’t change the color of object while running for this we have to create a timer thread by using
Void glutTimerFunc(unsigned int msecs,void (*func(int value),value) function or other techinque can also be use.
Parameter:
msecsNumber of milliseconds to pass before calling the callback.
func
The timer callback function.
value
Integer value to pass to the timer callback.