PDA

View Full Version : Using OpenGL with your own Matrices



DennisMV
11-14-2002, 06:00 PM
Hey,

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 ?

thanks,
Dennis

chowe6685
11-14-2002, 06:04 PM
you could just set both modelview and projection matricies to the identity and ignore them.

DennisMV
11-14-2002, 06:09 PM
thanks,

but is there a way to use your own matrix with openGL ?
Suppose, I have this:
double array[4][4]; //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 ?

thanks,
Dennis

Claude
11-14-2002, 09:14 PM
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.

Claude

DennisMV
11-14-2002, 10:22 PM
thanks !

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 ..

thanks,
Dennis

dorbie
11-14-2002, 10:51 PM
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.

J P
11-17-2002, 04:26 AM
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.