PDA

View Full Version : glGetFloatv dont work



01-22-2001, 08:21 AM
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

j
01-22-2001, 09:57 AM
You need to do:




glGetFloatv(GL_CURRENT_COLOR, &oldcolors);


It requires a pointer.

j

DFrey
01-22-2001, 10:04 AM
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.

01-22-2001, 11:07 AM
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

01-22-2001, 11:42 AM
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
01-22-2001, 11:52 AM
j, oldcolors is a pointer

Sorry, missed that.

j