PDA

View Full Version : Why use the "f" suffix?



Ginho!
09-13-2012, 07:20 AM
Hi everyone,
i'm a newbie in OpenGL, and i'm asking some question:
for example in this line:

glFogf(GL_FOG_DENSITY, 0.05f);

What does the "f" suffix stands for?

Another question:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

What does glMatrixMode and glLoadIdentity mean?

Thanks in advance :D

Coconut
09-13-2012, 07:38 AM
f stands for float, verses d stands for double etc.
There are four stacks of matrices: projection, modelview, texture and color.
Before you call glLoadIdentity to set the values of a matrix, you need to specify which matrix stack you want to set. So you call glMatrixMode() to set the "current" matrix.
In your 2 lines of code, glLoadIdentity() will set the value of projection matrix as identity matrix.

Ginho!
09-14-2012, 11:59 AM
f stands for float, verses d stands for double etc.


Thank you!


There are four stacks of matrices: projection, modelview, texture and color.

OK. What is matrices? :)
last question: glVertex sets a point of a polygon?

Cheers. :D

Ginho!
09-18-2012, 09:46 AM
Up .....................

thokra
09-18-2012, 01:28 PM
glVertex*() defines the position of a vertex which can either be rendered as a single point or can be a vertex in a sequence of vertices making up a more complex entity, like a line, a triangle, a quad or a more general polygon. The name of the function is a little misleading as it really defines the position in object-space, which is only one of potentially many so called vertex attributes a vertex may be associated with. Other vertex attributes may include a normal, a vertex color, a texture coordinate and so forth.

Note: glVertex*() is legacy OpenGL (http://www.opengl.org/wiki/Legacy_OpenGL)! Modern OpenGL uses different ways to specify geometry and vertex attributes. If you're just now learning OpenGL, please learn modern OpenGL, i.e. OpenGL 3.0 or higher.