Results 1 to 3 of 3

Thread: Porting from Direct3D to OpenGL...

  1. #1

    Porting from Direct3D to OpenGL...

    Does anyone have any experience porting from Direct3D to OpenGL?

    If so what pitfalls should I look out for? Any Hints/Tips welcome.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #2

    Porting from Direct3D to OpenGL...

    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>

  3. #3

    Porting from Direct3D to OpenGL...

    Quote Originally Posted by technomage
    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.
    You can use IDirect3DStateBlock9 interface to capture current render states and apply them later
    (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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •