View Full Version : glClearColor and ARR[]

03-15-2013, 06:54 AM
hi! I learning OpenGL with Qt library.
Can i do something like this:

GLfloat R, G, B;
GLfloat arr[] = {R, G, B}
glClearColor(arr.r, arr.g, arr.b);

glClear(GL_COLOR_BUFFER_BIT); // cleaned with the first color (R, G, B)


glClear(GL_COLOR_BUFFER_BIT); // cleaned second color (R+=0.1, G, B)

03-18-2013, 12:15 AM
Nope. Why?


For this to work, the GL first would have to have a reference to the system memory location and second actively observe value changes on that location - which it sure doesn't.

Simple call glClearColor with the changed values again. BTW, since you have to pass every single argument separately, there is not much use in putting the RGBA values in an array.