6 tutorials later, I noticed some codes that can be easily by a single line code. This code is the arithmetic condition. For those who forgot the definition, it is like the normal if...else condition with a difference: it''s written like
(condition?true:false);
for those who know algebra this example will help
(a > b?a:b);
. The equivalent is
if(a > b)
{return a;}
else
{return b;}
It is possible to use the function to return value. Let''s take the look on this example from lesson 7:
if (!light) // If Not Light
{
glDisable(GL_LIGHTING); // Disable Lighting
}
else // Otherwise
{
glEnable(GL_LIGHTING); // Enable Lighting
}
The equivalent is
(!light?glDisable(GL_LIGHTING):glEnable(GL_LIGHTING));
.
Don''t forget to add this library: #include <math.h>. Use it wisely

.