Reputation: 294
Recently, I've started working with OpenGL using C++.
I'm annoyed by the way of declaring Vertex or changing current Color
the glColor3f()
and glVertex{2,3,4}{sdif}()
methods.
now then, why OpenGL don't overload those functions.
for instance, it will be better to type glColor()
and glVertex()
and they will be recognized by the number of parameters and their type.
eventually, the code will look much better and easier to read, with the same results.
I hope there's a good reason to not overload similar functions.
Upvotes: 0
Views: 624
Reputation: 17708
Because OpenGL was originally designed with C as the primary language for its API, and C doesn't support function overloading.
However, quoting from Wikipedia:
Although the function definitions are superficially similar to those of the C programming language, they are language-independent.
It is always possible for OpenGL to have a C++ interface that supports function overloading and all the good stuff, though AFAIK there aren't any specification on that, and are mostly supported only with C++ wrappers.
Upvotes: 6