I think OpenGL should have native support for vector and matrices. Maybe you say that OpenGL isn’t a math library but it already has its “own” types, GLfloat etc. So, adding, multiplying, inverting etc. matrices and vectors should be native, because of the advances we could have of them…
Going through a DLL call (function pointer) just to do glTransformVector(&result,&vector,&matrix) when you are perfectly able to do that in your own code, faster, more flexible and more readable (function overloading, anyone?) to boot, is just silly.
OpenGL is not a generic utility toolkit, nor should it become one. Nor would it be practical (see above).
There are so many math libs out there already, I can’t even understand why you would want this.
This stuff is covered in each and every basic book on linear math, so if you can’t be bothered to write a simple matrix math lib (or find one on the net), it’ll get tough with graphics programming, I promise.
so if you can’t be bothered to write a simple matrix math lib (or find one on the net), it’ll get tough with graphics programming, I promise.
Sure I can write my own lib (or find one on the net), but if they are so fundamental in graphics as you say, why aren’t they supported? Maybe you think we don’t need GL_POLYGON either, since we have GL_TRIANGLES? GL_QUADS=GL_TRIANGLE_STRIP…
As you point out, there is little difference between GL_QUAD_STRIP and GL_TRI_STRIP. You can implement GL_QUAD_STRIP in terms of GL_TRI_STRIP.
The difference between that and a math library, however, is this. It takes an implementor 5 minutes (if that) to implement GL_QUAD_STRIP if they already have GL_TRI_STRIP. Yes, you can decide not to include it, but you aren’t saving much by not including it.
Forgetting for a moment that a math library is outside the realm of OpenGL, think about how much time it takes to implement a good one. It can take weeks to get a good design, and potentially a month or two to implement and debug it. This is a significant amount of work, compared to the QUAD/STRIP thing which is trivial at worst.
On the issue of a math library being outside the realm of OpenGL, that is true. Math libraries have existed before OpenGL. And OpenGL exists in the absence of a math library; it only does enough math to do rendering. These are two separate systems that have precious little to do with one another. Using OpenGL fully in a particular application may require a graphics library, but that doesn’t mean that using OpenGL requries a graphics library. Libraries should not be combined simply because it is convienient to do so. They should be combined if using one requires the other.
Lastly, there is the fact that OpenGL (nowadays) is mostly about interfacing with hardware. Most hardware accepts data, does something with it, and displays a result directly to the screen without asking the CPU for anything more than the original data. A math library cannot be implemented in this hardware. Therefore, ATi’s math library implementation will likely look 99% like nVidia’s does internally. In fact, every PC hardware vendor can simply get together and create one, and only update it when new CPU hardware comes out. In short, the libraries don’t benifit at all from hardware acceleration. Therefore, if OpenGL is to be considered an interface to hardware, why should OpenGL have these extranious functions which will never be hardware accelerated. Virtually every other OpenGL function is accelerated on some hardware somewhere. Math library routines are software routines; they have precious little to do with external (non-CPU) hardware.
[This message has been edited by Korval (edited 04-11-2002).]
Osku, what benefits would this have other than a (very small) amount of convenience?
Propably no benefits but it would be convenient, and since linear algebra is very much used in graphics programming, I think OpenGL should support it.
If anybody wants to do it, maybe a lib like glu that exposes mathematical functions. However i have the feeling that everybody would still write his own libs after his taste. So it would be a waste of time.
you can accelerate your math library by using nowerdays processors extensions as 3dnow, sse and sse2. Amd and Intel provide source code for those kind of math libs.
Look at their websites, there you’ll find a lot of stuff.