Skip to main content
gamedev.net
🔒 Locked

glGetFloatv ?????????

Started by cpp_boy Feb 1, 2004 at 8:45 AM 6 replies 600+ views
Original Post
cpp_boy
cpp_boy
This is my first post, HELLO EVERYBODY. I am using glGetFloatv(), but I can''t understend what it does. "The functions returns values of a selected parameters". What does this meens THANKS
OrangyTang
OrangyTang
void glGetFloatv(
GLenum pname,
GLfloat * params
);

The *params is a pointer to a suitably sized array to receive the data you''re requesting. The pname specifies what data you''re actually requesting (like GL_MODELVIEW_MATRIX).

Different parameters return differently sized amounts of data, so you have to make sure your array is big enough to hold it. The MODEL_VIEW matrix for example needs an array to hold 16 floats.
cpp_boy
cpp_boy
quote:
Original post by OrangyTang
void glGetFloatv(
GLenum pname,
GLfloat * params
);

The *params is a pointer to a suitably sized array to receive the data you're requesting. The pname specifies what data you're actually requesting (like GL_MODELVIEW_MATRIX).

Different parameters return differently sized amounts of data, so you have to make sure your array is big enough to hold it. The MODEL_VIEW matrix for example needs an array to hold 16 floats.


But why do I need to return that data, and what happends with
that data after it returns ?
Does this meens that I'm requesting to push m[] matrix into
modelview OR projection


[edited by - cpp_boy on February 1, 2004 10:05:03 AM]
Enigma
Enigma
If for example you wanted to find out what the current colour was you could do:
float currentColour[4]; // allocate a big enough array
glGetFloatv(GL_CURRENT_COLOR, currentColour);

currentColour would then contain the current colour.

Enigma
cpp_boy
cpp_boy
Thanks for the help guys, cos no google nor my opengl books
were able to help me......

Thanks again and seeya soon

[edited by - cpp_boy on February 1, 2004 10:29:15 AM]
Enigma
Enigma
Yes. For example, if you do:
glColor4f(1, 0, 1, 0);
// lots more code here
float currentColour[4];
glGetFloatv(GL_CURRENT_COLOR, currentColour);

then currentColour[0] will be 1, currentColour[1] will be 0, currentColour[2] will be 1 and currentColour[3] will be 0.

Enigma
cpp_boy
cpp_boy
THANKS GUYS, now I understand.

I have tomorow final test in graphics in my university, so I"ll study now, THANKS and seeya

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.