Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Cutting Edge Direct 3D Programming
(Publisher: The Coriolis Group)
Author(s): Stan Trujillo
ISBN: 1576100502
Publication Date: 11/01/96

Bookmark It

Search this book:
 
Table of Contents


Introduction

The origin of the human race and the details of our early history are the subject of much debate. Early human history is only loosely recorded, but we can make some educated guesses about how we spent our time. For example, it is safe to say that we spent a good deal of time designing and using tools.

When we think of tools today, we think of wrenches and hammers, or, for us programmers, software tools. But the first tool was probably a sharpened rock or bone that served as a knife. From this humble beginning, we eventually designed spears, skewers, shields, and sheaths. We designed vessels for the transport and storage of food and water and slings to carry infants. We invented sewing to hold skins together. Later we invented the wheel. The bronze age saw the introduction of metal pans, swords and shields. The industrial revolution changed the worlds of finance, labor and consumerism forever with the introduction of complex machines that could perform routine tasks consistently and reliably. The last one hundred years has brought cars, washing machines and can openers to millions of homes around the world.

The point is that is that we have inherited a rich and powerful legacy: a legacy of shapes, levers, pulleys, cams, and gears, and this technical portion of our heritage is fundamentally three-dimensional.

The Impending 3D Revolution

The two-dimensional desktop metaphor employed by Windows1 has been successful for word processing and spreadsheet applications because documents and spreadsheets are two-dimensional. For other applications, however, a 2D interface is stifling. Applications such as training simulators, educational software, medical imaging applications, architectural design software, games, and anything resembling virtual reality will all benefit from real-time 3D graphics technology. The desktop metaphor itself might someday be replaced with a 3D metaphor.


1Credit for the desktop metaphor goes to Xerox. Apple gets credited with the metaphor frequently because the Apple Macintosh was the first widely available computer that made use of the metaphor.

3D is not new. Real-time 3D graphics for PCs is new, but it is being adopted quickly because 3D graphics mean that we can stop thinking in 2D, and resume thinking in 3D.

Millions of years ago, a group of our ancestors celebrated the invention of the wheel. The new invention was no doubt put into use right away. Today, low cost real-time hardware accelerated 3D graphics is available for the average PC, and it’s time to put it to use.

What Is Direct3D?

Direct3D is a DirectX component that supports high performance 3D rendering and animation for Windows 95. Direct3D itself has two interfaces: Retained Mode and Immediate Mode. The Retained Mode interface provides a high level, powerful interface that allows complex 3D scenes to be maintained and rendered. The Immediate Mode interface is a low-level triangle processing layer. Internally, Retained Mode uses Immediate Mode. This book covers the Retained Mode interface.

Direct3D wasn’t actually written by Microsoft. It was written by a London based company called Rendermorphics and it was called Reality Lab. In February 1995, Microsoft acquired Rendermorphics, and began porting Reality Lab to Windows 95. In its current form, Direct3D is fundamentally dependent upon DirectDraw, the 2D graphics portion of DirectX. Direct3D uses DirectDraw for its underlying video buffers and page-flipping mechanisms. Like DirectDraw, Direct3D is written in such a way that it automatically takes advantage of any specialized hardware present on the video card (assuming that you are provided with the correct video driver). When a DirectDraw application runs on a video card that has a rectangle blitter, performance is enhanced dramatically. When a Direct3D application runs on a video card that has 3D hardware, performance is enhanced further. Optimum performance therefore requires a video card with 2D and 3D acceleration. Performance aside, it is not necessary to use an accelerated video card to develop applications for Direct3D2.


2I wrote the majority of the code for this book using a non-3D accelerated video card.

Reader Requirements

In order to use this book effectively, you must be a programmer, and you must know C++. You don’t have to be a C++ expert, but you should have an understanding of features such as classes and virtual functions. Some of these ideas can be picked up by observing the context in which they are used, but it never hurts to refer back to classic C++ books such as Stroustrup’s The C++ Programming Language (2nd edition) or Al Stevens Teaches C++.

You need to be familiar with Visual C++ and MFC (Microsoft Foundation Classes). We will be using only a portion of MFC, so MFC mastery is not necessary.

You will need to know some basic 3D concepts, but you are not required to know a lot of math. You do not need to understand rasterization algorithms, perspective transformations or phong shading to use this book.

Software Requirements

In order to use Direct3D, you will need Visual C++ 4.0 or greater, DirectX 2.0 or greater, and Windows 95.

Hardware Requirements

For the most part, any machine capable of running Windows 95 will do the job. Practically speaking, however, you should use be fast 486 or a Pentium. Sixteen megabytes of RAM is desirable. Visual C++, DirectX, and the code in this book comes on CD-ROM, so a CD-ROM drive is required. Finally, you’ll need a video card that is supported by DirectX.

Organization Of The Book

This book has 10 chapters. Chapter 1 is a quick review of Visual C++ and an introduction to the Direct3D AppWizard. Chapter 2 covers key 3D graphics concepts and terminology. Chapter 3 is an introduction to the Direct3D API. Chapter 4 documents Direct3D application structure. Chapters 4 through 10 cover Direct3D Retained Mode, and present 23 demos. For the most part, each topic is covered by a separate demo. Appendix A discusses the demo programs that are included with the book’s CD-ROM.

Getting Help

If you have questions, comments, or compliants, you can reach me at 75233.1506@compuserve.com.


Table of Contents


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.