glGetFloatv dont work

Why this is’nt working?

I want to store the current Color for later restoring:

//save the color
GLfloat oldcolors[4];
glGetFloatv( GL_CURRENT_COLOR, oldcolors );

//some something
glColor3f( some_other_color, … );

//restore the old color
glColor3f( oldcolors[0], oldcolors[1], oldcolors[2] );

…but something seems to be wrong with it, the getfloatv dont fill the “oldcolors” with the actuall color.

thanx
Phox

You need to do:

glGetFloatv(GL_CURRENT_COLOR, &oldcolors);

It requires a pointer.

j

j, oldcolors is a pointer. So &oldcolors is a pointer to a pointer. Instead I think the error may be that the glGetFloatv call is being made inbetween glBegin and glEnd.

Originally posted by DFrey:
j, oldcolors is a pointer. So &oldcolors is a pointer to a pointer. Instead I think the error may be that the glGetFloatv call is being made inbetween glBegin and glEnd.

the glGetFloatv call is not between glBegin and glEnd.

even when I do:

glColor3f(1.0f,1.0f,1.0f);
glGetFloatv( GL_CURRENT_COLOR, oldcolors );

the oldcolor-array not contains the WHILE-color.

Phox

problem solved!

the glGetFloatv works fine with the opengl-softwarerender. My OpenGl-Hardware-Driver seems not to support that feature (its an old alpha-driver only)

cu
Phox

j, oldcolors is a pointer

Sorry, missed that.

j