PDA

View Full Version : glGetFloatv(GL_CURRENT_COLOR, color) doesn't work



wwuster
12-29-2009, 11:06 AM
I'm testING getting GL_CURRENT_COLOR. If I set it to 1,0,0,1 and then immediately get it, it returns 1,1,1,1 instead of 1,0,0,1. Why doesn't the call return 1,0,0,1?


float color[4];
glColor4f(1,0,0,1);
glGetFloatv(GL_CURRENT_COLOR, color);

thanks,
William

mark ds
12-29-2009, 11:49 AM
try...

float color[4];
glColor4f(1,0,0,1);
glGetFloatv(GL_CURRENT_COLOR, color);
GLenum err = glGetError();

What does err return?

Also, do you have a valid rendering context before you make this call?

wwuster
12-29-2009, 12:03 PM
the error returned is 0

William

BionicBytes
12-30-2009, 08:27 AM
float color[4];
glColor4f(1,0,0,1);
glGetFloatv(GL_CURRENT_COLOR, color);


but you havw not actually sent anything to GL for rendering yet since glColor4f is a pervertex attribute. Try sending some geometry with glVertex3f then you'll see the expected results

V-man
12-31-2009, 09:13 AM
???
Is this important?