Game Development Community

DirectX again

by Robert Stewart · in Torque Game Engine Advanced · 10/15/2005 (11:26 am) · 4 replies

So if I had something code like this in TSE
D3DXMatrixTranslation(&mTrans,-200,-55,150);
Would that work? I'm still a little curios as to how TSE handles DirectX. If that did work, then when TSE works on Linux and Mac, this code would stop working right? So would that code still work for the Windows user? and have OpeGL code for the Linux and Mac.

#1
10/15/2005 (5:14 pm)
You can do that but it is a *bad* idea. As soon as someone switches to an OpenGL GFXDevice then your game won't run anymore (like on Linux and Mac). That function is doing an extremely simple matrix transformation (essentially adding 3 numbers together) so it is very easy to write a "safe" version of it.
#2
10/15/2005 (5:23 pm)
I was just wondering, because I have some code from DirectX I would rather not re-write. So I could in theory use the DX code for Windows, and OpenGl code for the Mac/Linux users.
#3
10/15/2005 (11:50 pm)
You could but it's going to break a lot of the GFX layer (ie, state caching will give VERY ODD results).

You're a LOT better off porting to GFX. If you have to use D3D directly, be very careful how you do it, and be aware you're really working counter to a lof of how the code is structured.

So.. yeah, you could do it, but it's not an idea I'd suggest.
#4
10/16/2005 (9:19 am)
Ok, thanks for the suggestions. I will port the code over to GFX then.