Hey, we have forums!

Author Topic: DirectX and OpenGL?  (Read 15580 times)

0 Members and 1 Guest are viewing this topic.

Offline Gravious

  • Mini Bit
  • **
  • Posts: 8
    • View Profile
DirectX and OpenGL?
« on: July 15, 2007, 12:08:46 am »
Hi,

I'm an established PHP developer who's looking to start making games in my spare time.  I'm set on using C++ and i want to develop 2D games (at least to start with,) so I've been looking at my options and i thought they boiled down to the following;
  • C++ & DirectX
  • C++, SDL/Allegro & OpenGL
So i was surprised to see Aquaria using OpenGL and DirectX together, obviously your using DirectX for everything other than the renderer, but why is that?  If your using DirectX so much, why not just use a Direct3D renderer?

Is there a reason your not using SDL or Allegro?
Eagles may soar, but Weasels don't get sucked in to jet engines.

Offline Alec

  • Administrator
  • Dream Bit
  • **********
  • Posts: 2211
    • View Profile
Re: DirectX and OpenGL?
« Reply #1 on: July 15, 2007, 01:45:27 am »
Actually, we don't use DirectX. Just XInput (the X360 Controller drivers). Sorry if something I said somewhere was misleading. :)

Right now we use SDL for input and window management, and OpenGL for rendering. The main reason for that is just 'cause I prefer the way OpenGL is set up. I prefer SDL to Allegro, just 'cause I think Allegro has a lot of components I wouldn't use in this situation. (although I love Allegro and used to use it back in the old days!)


DirectX
Pro: Supported on Windows XP and Vista, makes XBox360 port easier
Con: Not supported by Mac.

OpenGL
Pro: Supported on Mac
Con: Not supported at all or very well on Vista yet. :( (don't have too many details on this, but hopefully it'll change)
« Last Edit: July 15, 2007, 01:50:05 am by Alec »

Offline xander

  • Extra Bit
  • *****
  • Posts: 146
  • IV Migrant
    • View Profile
    • Reno Silver Blades Fencing
Re: DirectX and OpenGL?
« Reply #2 on: July 15, 2007, 02:42:33 am »
Con: Not supported at all or very well on Vista yet. :( (don't have too many details on this, but hopefully it'll change)
Hopefully.  The problem with OpenGL support in Vista is that most of the hardware manufacturers' drivers don't support it.  My understanding is that NVidia is working on it, and that ATi is basically ignoring the issue, especially with older cards.  At any rate, third party drivers will probably get done at some point, and OpenGL will be happy.

xander
FROG BLAST THE VENT CORE!

Offline Gravious

  • Mini Bit
  • **
  • Posts: 8
    • View Profile
Re: DirectX and OpenGL?
« Reply #3 on: July 15, 2007, 02:59:58 am »
Well I'm running an nvidia 8800GTX on vista and can play OpenGL games (so far) without issue.  I believe it is vendor based driver issues that are causing the problem and as the drivers are being updated the issues are getting smaller.

On a side note, I've got Visual C++ 2005 on Vista and I've been able to compile some OpenGL tutorials and have them run successfully, so i think I'll have a look for some SDL/OpenGL tutorials now  :D
Eagles may soar, but Weasels don't get sucked in to jet engines.

Offline Alec

  • Administrator
  • Dream Bit
  • **********
  • Posts: 2211
    • View Profile
Re: DirectX and OpenGL?
« Reply #4 on: July 15, 2007, 03:18:45 am »
Thanks, xander. I hope it all gets solved up nice.

As for SDL/OpenGL tuts...

Simple Intro:
http://gpwiki.org/index.php/C:SDL_OGL

Think this is the NeHe examples redone with SDL:
http://www.libsdl.org/opengl/OpenGL-intro-1.1.1.zip

'Nother one that looks promising:
http://www.devshed.com/c/a/Multimedia/Using-OpenGL-with-SDL-for-Game-Programming/

There's some other one that was more a reference page that I really liked, but can't find it atm.

Offline Gravious

  • Mini Bit
  • **
  • Posts: 8
    • View Profile
Re: DirectX and OpenGL?
« Reply #5 on: July 15, 2007, 03:31:06 am »
Thanks, xander. I hope it all gets solved up nice.

As for SDL/OpenGL tuts...

Simple Intro:
http://gpwiki.org/index.php/C:SDL_OGL

Think this is the NeHe examples redone with SDL:
http://www.libsdl.org/opengl/OpenGL-intro-1.1.1.zip

'Nother one that looks promising:
http://www.devshed.com/c/a/Multimedia/Using-OpenGL-with-SDL-for-Game-Programming/

There's some other one that was more a reference page that I really liked, but can't find it atm.

Thanks, that's fantastic  ;D

By the way, Aquaria is looking fantastic, i hope it works on Vista (lol?)
Good fortune to you all.
Eagles may soar, but Weasels don't get sucked in to jet engines.

Offline wesley

  • Bit
  • ***
  • Posts: 46
  • Ubuntu Developer
    • View Profile
    • Personal TechBlog (Dutch)
Re: DirectX and OpenGL?
« Reply #6 on: July 15, 2007, 03:47:46 am »
For basics, this is a pretty good page too.
http://lazyfoo.net/SDL_tutorials/index.php

But I think that the author of those tutorials isn't very advanced himself.
He does some weird things sometimes, but it's a good introduction to SDL.

For OpenGL you'll have to read through some of the the NeHe tutorials/examples.

Have fun.

PS: I strongly advise you to stick with SDL + OpenGL, as it is a very capable combination, used by some very popular game makers. And SDL/OpenGL itself is very portable to other devices and/or operating systems. (Allegro is cross-platform too though, but I have no experience with that and I haven't seen that many people use it)
Human Knowledge Belongs To The World - Antitrust (2001)
http://www.ubuntu.com

Offline Alec

  • Administrator
  • Dream Bit
  • **********
  • Posts: 2211
    • View Profile
Re: DirectX and OpenGL?
« Reply #7 on: July 15, 2007, 03:50:28 am »
I think the only cases where you'd want to use DirectX over OpenGL:

  • if you prefer how DX's commands are set up
  • if you need certain visual effects (DX has a different Shader language, some claim its better / has different functionality)
  • if you're targeting XBLA (it would make a 360 port much simpler)

Offline Gravious

  • Mini Bit
  • **
  • Posts: 8
    • View Profile
Re: DirectX and OpenGL?
« Reply #8 on: July 15, 2007, 04:07:36 am »
I heard that DirectX is all pointers and classes while OpenGL is pretty much all function based?  Would you say that is accurate?

Though pointers and classes are available in PHP, they're horribly implemented and i don't use them much yet..  :(
Eagles may soar, but Weasels don't get sucked in to jet engines.

Offline xander

  • Extra Bit
  • *****
  • Posts: 146
  • IV Migrant
    • View Profile
    • Reno Silver Blades Fencing
Re: DirectX and OpenGL?
« Reply #9 on: July 15, 2007, 04:14:13 am »
I strongly advise you to stick with SDL + OpenGL, as it is a very capable combination, used by some very popular game makers. And SDL/OpenGL itself is very portable to other devices and/or operating systems. (Allegro is cross-platform too though, but I have no experience with that and I haven't seen that many people use it)
There are good reasons to stick with the SDL/OpenGL combo.  However, there are good reasons to go with DirectX as well.  One of them is XBox compatibility, and getting the "Games for Vista (or Windows or whatever it is)" logo on the box.  As a Linux user, you may not find that important, and, as  Mac user, I would prefer OpenGL; but, as a software developer, being able to sell your games via the Windows/MS marketing machine must be attractive.  I know that IV rewrote the Darwinia rendering engine to incorporate DirectX -- this was done, in part, for Vista compatibility, but I imagine that it was also done to sell through the "Games for Windows" program.

xander
FROG BLAST THE VENT CORE!

Offline Alec

  • Administrator
  • Dream Bit
  • **********
  • Posts: 2211
    • View Profile
Re: DirectX and OpenGL?
« Reply #10 on: July 15, 2007, 04:17:03 am »
IMO I just find OpenGL has a simpler, cleaner system. DirectX is a bit more "messy".

But they're both solid, and I wouldn't try to convince anyone to use one over the other. It depends on the project and your personal taste.