glClearColor and ARR[]

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)

arr[0]+=0.1

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

Nope. Why?



arr[0]+=0.1

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.