![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Cutting Edge Direct 3D Programming
A Custom Direct3D AppWizardVisual 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-ROMs Direct3DAppWiz\Release directory into the \msdev\template directory or by using the CD-ROMs 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. Youll also need to enter the project name. For this example, well 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.
The first dialog is an introduction to the AppWizard. Press the Next button to proceed to the second dialog shown in Figure 1.12.
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.
The third AppWizard dialog lets you choose what (if any) types of light sources you want in the application. Well talk more about light sources later. For now, well 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.
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.
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.
Windows Code, And Wrapping UpWindows code has a distinct look. Event-driven programming isnt 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 solvewith 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 doesnt 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 cant be used by derived or external classes anyway. Youll have ample opportunities to apply this chapters concepts as you create Direct3D applications throughout the rest of the book.
|
![]() |
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. |