Direct3D

From ArticleWorld


Direct 3D is a part of the DirectX API, responsible for rendering 3D graphics in applications with high demands in terms of performance and response time. It allows the application to run both full-screen and in a window, depending on the programmer's option.

Direct3D can be used for Windows version starting from Windows 95. It is also available on the Xbox and Xbox 360, although quite significantly changed. It can use underlying hardware graphics acceleration if it exists, allowing for better performance.

The API

The DirectX API is a direct competitor of OpenGL, featuring a large number of features that make it the choice for many programmers. The API is continuously updated, in order to support the features of the latest graphics cards. However, Direct3D offers no pixel software emulation, often posing some trouble to users. The API also defines a Reference Rasterizer REF), a device that emulates a generic graphics card, but it is too slow to emulate features which are not supported. Aside from these, vertex shaders, pixel shaders, fog, bump mapping and texture mapping are supported. From version 9.0, a a new version of the High Lever Shader Language was introduced, along with support for dynamic range lightning, vertex buffer indexing and multiple render targets.

Direct3D vs. OpenGL

The debate has been ongoing for some time now, and it is difficult to chose a winner. The main disputes are based around the following topics:

  • Portability. Direct3D is a non-portable API, proprietary and implemented only on Microsoft Windows. The Wine project does strive to implement its functionality, but the API is strongly bound to the Windows platform. OpenGL is an open API, available on many platforms. In fact, it is the 3D graphics API of choice today, on all platforms except Microsoft Windows.
  • Programming model. While Direct3D is based on Microsoft's COM, while OpenGL is based on pure C, based on a finite state machine model. Direct3D is therefore rather clumsy to use at times, although this may be put on the fact that it has a different purpose than OpenGL. Direct3D is rather a hardware interface, while OpenGL is, first of all, a rendering library, which may or may not be hardware accelerated.
  • Performance. The API wars engaged by Microsoft with SGI was historically bashed in 1996. Initially, Microsoft had marketed Direct3D as vastly superior to OpenGL in terms of performance. However, at SIGGRAPH, SGI showed how this was due to Microsoft's poor implementation of OpenGL, and not the design flaws of OpenGL, as Microsoft suggested. This only heated up the debate. It has been shown that there is no inherent speed gain of one API over another, as the performance greatly depends on the implementation and the skill of the designers and programmers of the application.