Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

billybob

OpenGL converting an opengl matrix to a d3d matrix

This topic is 5570 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
No, you do nothing at all. To use D3D matrices in OpenGL functions you just pass them as the parameter in glLoadMatrixf, with no conversion whatsoever . Trust me, I do this. The function accepts a float pointer, which the D3D matrix casts to (it returns the pointer to the first element). It works perfectly.

EDIT: I forgot to mention that OpenGL uses a right-handed coordinate system, so the matrices should be right-handed. If you're using the D3DX matrix functions, use the *RH ones.

~CGameProgrammer( );



[edited by - CGameProgrammer on June 19, 2003 1:45:24 AM]

Share this post


Link to post
Share on other sites
i''m not talking syntactically (i know to cast it, of course it works, 16 float array is the same as a struct of 16 floats), i mean to get the right thing to show up on the screen. i''m not using any matrix functions, my own, which i THINK are opengl type ones.

Share this post


Link to post
Share on other sites
That''s what I meant too. My engine supports both OpenGL and Direct3D. Both APIs use exactly the same matrices; that''s why I emphasized that conversion was not needed. You do NOTHING to get them to work with both APIs, as long as they are right-handed matrices.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
Are you talking about changing a matrix from a right hand system of opengl to a left hand system of directx?
~Wave

Share this post


Link to post
Share on other sites
yes, i want to use the same matrix code in both APIs, what i have now is (i think) opengl matrix form.

Share this post


Link to post
Share on other sites
It makes sense because it works. OpenGL and Direct3D produce exactly the same results using exactly the same matrices. I''m not making this up. The reason is the components are in the same order in both formats.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
He''s saying use the *RH postfixed functions which accept OpenGL style column-major matrices, can''t confirm this as I don''t use DirectX.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!