converting an opengl matrix to a d3d matrix

Started by
11 comments, last by billybob 20 years, 10 months ago
Using the matrix transpose extension should avoid the little waste of time in transposing your matrix, btw.
Advertisement
One thing that always bothers me is this idea that "OpenGL is right-handed, and Direct3D is left-handed". Either API is equally capabable of working in a left-handed or right-handed coordinate system. The only times you need to worry about this, is when you are setting up your projection matrix, and choosing your cull mode.

OpenGL thinks of its matrices logically as column-major.. but it stores them in memory in row-major order. Direct3D thinks of its matrices logically as row-major.. and stores them in memory as row-major. CGameProgrammer is correct.. the in-memory representation is the same.

The real difference between OpenGL and Direct3D when it comes to matices is not right-vs-left handedness or row-vs-column majorness.. it is the space in which clipping is performed. OpenGL clips X,Y,Z from -W to W. Direct3D clips X,Y from -W to W, and Z from 0 to W. This has implications on how you form your projection matrix.

xyzzy
ok thank you all, i get it now

This topic is closed to new replies.

Advertisement