Converting from Opengl

Started by
3 comments, last by onnel 22 years, 8 months ago
I ve some relatively simple code that I want to convert from opengl. Anyone lend a hand? glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glPushMatrix(); glMultMatrixf(m); // m is a known matrix - do I need to do anything to convert from opengl to dx matrices? DrawModel(link); // A new method I wrote...no problem glPopMatrix(); Any help on the pushmatrix and matrix multiply would be great. Also, any help on converting an opengl matrix to dx if it''s not direct. Thanks! Onnel
Advertisement
look at the sdk documentation:

look at SetTransform

and the D3DXMatrix... functions

Also, DX8 doesn''t have a stack by default, but there are D3DX stack helper interfaces.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I figured to use the D3DXMatrixMultiply. Does the order of the matrices matter in this case?

I assume the stack is simply a way to store a matrix and then be able to retrieve it. If this is the case, I can simply store my existing matrix and then reset it afterwards.

Which DX matrix matches gl_modelview?

Also, do any changes need to be made to the way a matrix is stored?

Onnel
at the risk of sounding bad... It will be worth your time to skim the documentation...

Some answers:

* multiplication order matters (always)

* stack - sure, you could store/reset...

* in DX, there is a world matrix and a view matrix (read the docs)

* no, I believe the matrix format is the same...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
O.K., I think all that matches up with what I was thinking (I knew most of it, but wanted confirmation).

I switched to using the D3D Matrix stack, but I don''t think that makes any functional difference. I noticed there was a MatrixMultiply and MultMatrixLocal..I''ll try with the Local version...

Thanks for confirming my thoughts!

Onnel

This topic is closed to new replies.

Advertisement