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:
 
Previous Table of Contents Next


A Custom Direct3D AppWizard

Visual C++ allows you to write custom AppWizards. Custom AppWizards can be written to generate just about any application imaginable. The CD-ROM that comes with this book includes a custom Direct3D AppWizard that you can use to create fully functional Direct3D applications.

Custom AppWizards are special DLLs (Dynamic Link Libraries) that have an AWX extension. AppWizards can be installed by copying the AWX file into the Visual C++ template directory (usually c:\msdev\template). The Direct3D custom AppWizard can be installed either by copying the Direct3DAppWiz.AWX file from the CD-ROM’s Direct3DAppWiz\Release directory into the \msdev\template directory or by using the CD-ROM’s installation program.

After installing the custom AppWizard, get into the Developer Studio and choose New from the File menu; then select Project Workspace, and press the OK button. The New Project Workspace window will appear. Scroll down to the bottom of the Type list-box and select Direct3D AppWizard as shown in Figure 1.10. You’ll also need to enter the project name. For this example, we’ll use “Sample3D.” After you enter the project name, press the Create button. Now, the first Direct3D AppWizard dialog shown in Figure 1.11 will appear.


Figure 1.10  Selecting the Direct3D AppWizard.


Figure 1.11  The first of four Direct3D AppWizard dialogs.

The first dialog is an introduction to the AppWizard. Press the Next button to proceed to the second dialog shown in Figure 1.12.


Figure 1.12  The Object selection dialog.

The second AppWizard dialog allows you to specify the 3D object that will be displayed by the Direct3D application that you are creating. By default, the Swirl object shown on the dialog will be used, but you can select another object by selecting Let me choose an object and entering the object name in the Object edit control. You can also use the Browse button to locate an object (Direct3D object files have an X file extension). For this example, we will use the default object. Pressing the Next button will take you to the dialog shown in Figure 1.13.


Figure 1.13  The Lighting selection dialog.

The third AppWizard dialog lets you choose what (if any) types of light sources you want in the application. We’ll talk more about light sources later. For now, we’ll just use the default directional light source.

The color of the light sources can also be adjusted from this dialog. By default, each light source uses white as its color. Press the Next button to go to the fourth AppWizard dialog, shown in Figure 1.14.


Figure 1.14  The class names dialog.

The fourth dialog lets you override the class names that the AppWizard suggests. Accept the defaults and press the Next button.

Now the AppWizard displays a confirmation dialog (Figure 1.15) so that you can review your choices.


Figure 1.15  The Direct3D AppWizard confirmation dialog.

Visual C++ creates the new project when you click on the confirmation dialog OK button. Compile the project by pressing F7, and execute the new application by pressing F5. Figure 1.16 shows the new application.


Figure 1.16  The new Direct3D application.

Windows Code, And Wrapping Up

Windows code has a distinct look. Event-driven programming isn’t the only thing that Windows newbies have to adjust to. One of the reasons Windows code looks different is because Windows programmers often use Hungarian notation. Hungarian notation uses variable prefixes to identify the type of each variable, and is useful in languages that have little or no variable type checking.

One key features of C++ is strong type checking. This means that C++ solves the problem that Hungarian notation was intended to solve—with one improvement. With C++, the compiler does the type checking, not the programmer. The leaves you free to concentrate on more important things (like 3D graphics). The code in this book doesn’t use Hungarian notation.

Another departure from tradition is that the classes in this book are arranged so that the public member functions appear at the top of the class. This is because the public interface is usually the topic of interest for users of the class. Private data members and functions are included near the bottom of each class because they can’t be used by derived or external classes anyway.

You’ll have ample opportunities to apply this chapter’s concepts as you create Direct3D applications throughout the rest of the book.


Previous Table of Contents Next


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.