ASP.NET
  Home arrow ASP.NET arrow Page 3 - Managed DirectX First Steps: Direct 3D Bas...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Managed DirectX First Steps: Direct 3D Basics and DirectX vs. GDI+
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 65
    2005-01-26

    Table of Contents:
  • Managed DirectX First Steps: Direct 3D Basics and DirectX vs. GDI+
  • DirectX Overview
  • Referencing DirectX Libraries
  • Put That in Your Pipeline and Shade It
  • 3-D Coordinate Systems and Projections
  • Drawing Primitives and Texture
  • The Application Proposal
  • The Coding Phase
  • Second Step: Coding Your First Windowed Test
  • Code the Render Procedure
  • Fourth Step: Using Transparent Textures
  • Fifth Step: Changing Diffuse Colors
  • Sixth Step: Testing Matrix Transformations
  • Adding the Final Touches

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Managed DirectX First Steps: Direct 3D Basics and DirectX vs. GDI+ - Referencing DirectX Libraries


    (Page 3 of 14 )

    When writing DirectX programs, you’ll need to add references to the DirectX libraries to your project. This can be done in one of two ways in Visual Studio: either by using the DirectX Wizard or by selecting the Add Reference option after right-clicking the project to bring up the Add Reference dialog box (see Figure 3-2).


    Figure 3-2.  Adding references to your project

    If you’re not using Visual Studio, you can include references by using the /r: option in the command line.


    Understanding Devices

    Having access to the adapter isn’t enough. You still want the flexibility to create multiple connections into an adapter, each one capable of handling all the fancy 3-D magic that modern graphics processors can do these days. In DirectX, that connection is called a device. Each adapter can have multiple devices, but each device is one of three different types:

    • Hardware (hardware abstraction layer, or HAL): When creating HAL devices, you have direct access to the hardware acceleration features (and the resultant increase in speed). If you try to create a device of this type but have no 3-D acceleration board, DirectX will raise an error and won’t create the device.

    • Reference (Reference Rasterizer): This type of device, included in the DirectX SDK, provides most of the features available for the DirectX functions, and doesn’t depend on any hardware support—everything is done in software. Although this type of device is very flexible, it’s very slow, and should only be used for debugging purposes, because it allows you to test many features not supported by your hardware. Don’t even think about creating a game with it, as the frame rate is very low—between 1 and 5 frames per second, usually.

    • Software (software device): This isn’t used unless you need plug-in support for a custom renderer.

    When creating a device, you must specify the adapter being used (usually the default, defined as “0” [zero]), the type of the device as described in the preceding list, the handle of the window that will be used as a viewport, and two other parameters that will define the details about the device creation, the behavior flags and the presentation parameters, as shown in the next code sample:

    Direct3DDevice=new Device(Manager.Adapter,DeviceType.  
       Hardware,
      WinHandle, CreateFlags.SoftwareVertexProcessing,
       objDirect3Dpp);

    The behavior flags must be one of the following flags defined by the CreateFlags enumeration:

    • SoftwareVertexProcessing: This option tells DirectX that all vertex calculations will be made by software. This option is the slowest, but is always available.

    • HardwareVertexProcessing: This option forces DirectX to rely on hardware capabilities to make all the vertex-processing operations. If the hardware isn’t able to perform the vertices calculation, the creation of the device will fail.

    • MixedVertexProcessing: As the constant name states, this uses a mix of available hardware features and software-implemented ones to achieve the best results. If the hardware offers no vertex-processing features, this call will fail, too.

     

    This chapter is from Beginning .NET Game Programming in C# by David Weller et. al.(Apress, 2004, ISBN: 1590593197). Check it out at your favorite bookstore today. Buy this book now.

    More ASP.NET Articles
    More By Apress Publishing


     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek