Is there a way to completely use ONLY your own matrices in OpenGL ?
I’m using OpenGL with C++, and I am implementing my own matrix class. I will load an object and then do various transitions with it using my own matrices and my own matrix multiplication/etc. routines.
I looked on the web, and there is to specify your own matrices, but I haven’t found a good source.
So, the thing I need to know is: is there a way to completely avoid OpenGL’s matrix operations and use your own ?
you could just set both modelview and projection matricies to the identity and ignore them.
but is there a way to use your own matrix with openGL ?
Suppose, I have this:
double array; //which is my own matrix for rotation for example.
Can I integrate it with OpenGL somehow, so after I apply it, the object is rotated ?
In the Red book,they mention that
glLoadMatrix*() and glMultMatrix*()
allow you to specify any transformation matrix directly and then to multiply the current matrix by that specified matrix.
Might be what you’re looking for.
The other way would be to apply the matrix
yourself to each vertex before drawing.
Hope this helps.
I figured it out ! those were the commands I was looking for.
However, you got me interested – how do I apply
How can I apply a matrix to each vertice before drawing ?
I’ll need that too, since I will need to draw an object, but before I’ll draw it I’ll need to transform it …
If you want to do your own transformation just set the modelview and projection to identity.
Then you can transform your vec4s in software yourself and send the results to the pipe in the usual way.
There is a tut/demo of how to do this at http://www.mfcogl.com/
See OpenGL Topics, Rotate (Cylinder) Yourself. It is in MFC but the math and OpenGL is the same.