I am using this tutorial and OpenGL superbible to learn OpenGL(4.3 and above) as a part of learning the concepts in 3D Computer Graphics and Rendering.
I wanted to try some initial experiments which involves the changing of color of window. For that I am using following code
time_t tt;
time(&tt);
GLfloat color[4];
color[0] = (float)sin(tt) * 0.5f + 0.5f;
color[1] = (float)cos(tt) * 0.5f + 0.5f;
color[2] = 0.0f;
color[3] = 1.0f;
glClearBufferfv(GL_COLOR, 0, color);`
I tried inserting it in RenderFunction()
and below the fprintf
function of Chapter1.c, but still the window does not change the color. I know this is a dumb enough experiment which animates the window but I just wanted to try and learn. My question is, where should I put my code or what modifications should I do in this tutorial code so that it will change the color of the window?
UPDATE: I read this question which is somewhat relevant but still I am not able to animate the window.