The OpenGL designers were never afraid of mathematics, and knowledge of linear algebra is essential for all but the simplest OpenGL applications. I think it can safely be assumed that OpenGL programmers are familiar with angles in radians.
Mathematically, radians are more elegant than degrees in every respect. They also have practical advantages:
Why, then, did the OpenGL designers decide to specify functions like glRotatef
and gluPerspective
to use degrees?
(I know it's of no practical importance, and it's not going to change anyway. I'm just curious, and I couldn't find the answer on OpenGL.org.)
In particular, rotational motion equations are almost always expressed using radians. The initial parameters of a problem might be in degrees, but you should convert these angles to radians before using them. You should use degrees when you are measuring angles using a protractor, or describing a physical picture.
Whereas degrees are simpler to use in everyday life, radians are more natural in math and circle geometry. Practice using and converting between the two.
You should specify radians as in glm::radians(45.0f) for example. In any case the warnings are a transitionary measure which will likely disappear in the future. Youre always going to incur some runtime cost when you need to transform your data because a lower level requires it.
Simply put, a radian is another way to measure an angle instead of using degrees. You are merely switching the unit of measurement. It is like measuring your height in centimeters instead of inches.
Because normal people are more used to calculating degrees -- OpenGL is meant to be used simple. Note that all the functions that operate on degrees are "high level" functions.
For OpenGL itself, it's no difference whether it receives radians or degrees -- they are internally converted to transformation matrices anyway, so there's no computational gain of using one or the other.
So why complicate stuff for people if you can allow them using degrees? Anyone coding seriously in OpenGL will provide their own matrices computated from quaternions anyway.
In the same spirit we could ask, why have glRotatef
and gluPerspective
anyway, since matrices are more elegant in every respect, and allow a higher grade of control.
Point by point:
Also note: all of the functions using degrees are in the current standard (3.2) deprecated. glRotatef
is the only function taking degrees, or as a matter of fact, an angle at all. glu is a utility library not meant for heavy-duty deployment, hence it's tailored towards readability, and gluPerspective(... 60.0f..)
is much more readable and "standard" in terms of supplying FOV than gluPerspective( ... M_PI / 3.0f ... )
would be.
Final notes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With