This is a mirror of official site: http://jasper-net.blogspot.com/

Direct3D Programming with MinGW

| Sunday, March 7, 2010
This article describes a Direct3D demonstration program, and shows how to build it using the MinGW C++ compiler (a free, Windows-hosted implementation of the GNU C++ compiler). It is hoped that the material presented will be useful for Direct3D programmers wishing to apply their knowledge using MinGW, as opposed to Visual Studio.

In addition, the article gives a quick introduction to Direct3D, in particular to its more advanced "immediate" mode of operation. The demo presented renders a single solid - a cube - complete with texture and lighting. This cube is rotated about all three axes while being viewed by a stationary camera. Not much depth is given in the explanation of the demo, but a survey of all the parts of a minimal Direct3D program is at least provided.

The article attempts to be as explicit and self-contained as possible. Even if you do not have MinGW and/or Direct3D installed, the article contains instructions (e.g., download URLs) to get you started.

Using a non-Microsoft compiler to build a Direct3D app presents some unique challenges. The article aims to provide as much relevant information as possible. For example, the precise build command used is shown, and explained in some detail.

Before going further, a few caveats are in order. First, although the article gives a rather complete description of the demonstration code, many Direct3D topics are necessarily left unexplored. For example, the demo solid is rendered using triangle strips. This is only one of several ways to construct 3D solids, and the other methods are left unexplored.

In addition, the article completely omits one particularly important topic for production-quality Direct3D development: the enumeration of device capabilities. Optimal, production quality Direct3D applications typically behave differently on different graphics hardware. High-performance devices will have more GPU capabilities than low-performance devices, and a production-quality app should exploit each piece of hardware to the greatest extent possible.

The demo code presented here - in the interest of simplicity - takes a "one size fits all" approach, in which only the bare minimum of 3D capabilities are assumed, even on high-end computers. These simplifications were deemed acceptable for this article, which strives to introduce Direct3D as briefly as possible. However, such a design would be out-of-place in more polished Direct3D code.

Similarly, very little error handling is attempted here. Again, this was viewed as a necessary sacrifice in order to provide a concise introduction to some very broad and complex topics. Another compromise is the requirement that a texture file bitmap ("PlainTex.png") be present alongside the demo executable. A more full-featured app would be capable of emitting this file, as needed, at program startup.

Read more: Codeproject

Posted via email from jasper22's posterous

0 comments: