Does anyone have any experience porting from Direct3D to OpenGL?
If so what pitfalls should I look out for? Any Hints/Tips welcome.
Does anyone have any experience porting from Direct3D to OpenGL?
If so what pitfalls should I look out for? Any Hints/Tips welcome.
Hi Dom
I've not ported stuff from DirectX to OGL before, but I have tried to write a single API to work with both.
One of the main differences I found is that there does not seem to be any way in DirectX to save the current state like you can in Opengl with glPushAttrib and glPopAttrib.
Other differences come when setting colors for Verticies, in opengl if you use Immediate mode to send your data (I would recommend you don't , but it is very useful to start off with), you must remember to send data such as color, texcoords , etc BEFORE sending the glVertex call.
DirectX does not have an immediate mode as such , you have to use Vertex buffers / Arrays.
My main problems however have been in dealing with textures, and the fact that DirectX works in the Right Hand coordinate system while OpenGL works on the Left (or the other way round) . Basically they are different, so if you want to make use of built in functions like gluLookAt you have to keep that in mind. I decided to force OpenGL to use the same coordinate system as DirectX but if you do that you have to code most of the glu style functions yourself.
Hope this helps
<A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
<br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
<br /></A>
You can use IDirect3DStateBlock9 interface to capture current render states and apply them laterOriginally Posted by technomage
(although Push/Pop attrib is easier to use).
http://msdn2.microsoft.com/en-us/library/bb205887.aspx
Vampyre Imaging Library
Earth Under Fire (PGD Big Boss 3rd place)
Domains Of Chaos (PGD Multiplexity 5th place)
Bookmarks