I've noticed a function in OpenGL that has f after each parameter like so - glVertex3f(1.0f,1.0f,1.0f); - does anybody know what the f's mean and why the need to put them there and also what difference it would make without them?
I've noticed a function in OpenGL that has f after each parameter like so - glVertex3f(1.0f,1.0f,1.0f); - does anybody know what the f's mean and why the need to put them there and also what difference it would make without them?
It means float.
I don't think there's any difference between 1.0 and 1.0f, but there is a difference between 1 and 1f.
In the first example, both are floats. In the second, the first is an int and the second is a float.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Type conversion to float. If you donīt convert, the numbers is treated as double.
OpenGL follows a naming convention for all of its functions...
Example from "OpenGL Superbible 2nd edition":
glColor3f(...);
This means it's part of the gl library
This is referred to the "root command"
This is the number of arguments
This is the type of arguments, as Magos said
Without the postfixes on numbers like 1.0f, they are created as the first type which can hold the specified value. So you're basically saying, create the value 1.0 and make it the size of a float.