Jump to content


OpenGL vs Direct3D: the debate


1 reply to this topic

#1 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 02 May 2009 - 10:14

OpenGL and Direct3D are two programming libraries that provide fast and direct access to the computer's graphics hardware, and allow for fast hardware-accelerated 3D rendering.

OpenGL is the older of the two, and was initially intended to be a general-purpose API for any 3D rendering application. Its philosophy has been to offer support for any feature even if the hardware does not implement that feature. The feature would have been emulated if it wasn't available. However with the coming of hardware accelerated rendering, the focus has been more on the advanced features these graphics cards offer. OpenGL is standardised and has been implemented on many platforms; it is currently available on Windows, Linux, Mac OS X and many others. As an API, OpenGL is normally implemented in C, and built around a state machine. Very few of the function calls have return values or error codes, so using OpenGL comes down to 'sending stuff down the line'.

Direct3D was developed exclusively by Microsoft as a part of DirectX. Right from the start its aim was to provide an interface to the graphics hardware, and was designed with games in mind. The API itself is written in C, and is similar to the standard Win32 API. This means function calls with 5-10 parameters on average, lots of typedefs, and general code management havoc. A major downside of Direct3D is that it's not portable, so using it automatically ties any game to Windows only. Its integration with Win32 also gives problems for those wanting to use something other than Win32 instead.

I think the non-portability of Direct3D automatically disqualifies it as a viable alternative. Portability is a big issue nowadays, and it's stupid to think Windows is the only platform out there. From what I've seen of Direct3D it's also rather messy (as most Microsoft code is), while OpenGL is very clean and neatly designed overall. Perhaps the only real thing lacking with OpenGL is any form of object-oriented programming, but its implementation as a state machine does simplify the approach somewhat and makes it easy to manage.
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#2 Sgt. Rho

    Kerbal Rocket Scientist

  • Project Leader
  • 6870 posts
  • Projects: Scaring Jebediah.

Posted 02 May 2009 - 11:05

due to it's portability, and the fact that to initialise a directX you need to write friggn 2,5MB of code to execute it (joke...), I preffer openGL



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users