Click here to Skip to main content
15,893,337 members
Articles / Multimedia / DirectX
Article

DirectX Lessons, Lesson 2 (Direct3D Device Initialization)

Rate me:
Please Sign up or sign in to vote.
1.00/5 (26 votes)
28 Aug 20042 min read 82K   1K   9   13
The second lesson in the DirectX lessons in C#

Introduction

This is the second lesson in the Game Programming Using DirectX within C#, there's some thing i had forgotten to include in my first lesson, in order to run these lessons in your machine, you must have Microsoft Visual C# 2003 With .Net framework 1.1 and Microsoft DirectX Sdk 9C with managed DirectX installed on your machine.

 

Now back to our lesson,  now we had reached the beginning of our party, so what’s the Direct3D initialization?

Before answering this Question, we must know about some terminologies used by Direct3D, the most important term of them is the Device, so what’s the Device?

 

Every pc nowadays has a graphics card, we have hundreds of models, with variety of capabilities, so do we need to maintain a different ways to react with different cards, in other ways do we need to make a code to act with every card model?

No, because if this is true, no one will play any game, cause imagine you had packed you game, and after that a new card had been launched, if these words are true, your game wont work on the new card, so how we maintain the workability of our game on all cards?

Direct3D had answered this question for us, by using what’s known by Device, the rule played by the device is so easy, simply every card vendor make what’s known by Card Driver, which is an Interface to handle any specified use to the card, Direct3D simply uses this Drivers which have fixed framework whenever the vendor is, we’ll look now at this model.

This model is known by HAL (Hardware Abstraction Layer), The HAL is a device-specific interface, provided by the device manufacturer, that Direct3D uses to work directly with the display hardware. Applications never interact with the HAL. Rather, with the infrastructure that the HAL provides, Direct3D exposes a consistent set of interfaces and methods that an application uses to display graphics, for more information about this topic feel free to see the DirectX SDK.

Sample screenshot

 

Now we had known all what we need about the Device, so initialization is simply to initialize the Device object, in other words to choose its working modes, like resolution, color depth, type of vertex processing and so on, we’ll cover all these topics along we go through our course, but for now we are gonna just initialize the Device by the most simple properties to work with it in window mode without much capabilities.

 

Now the second lesson had been finished, and we'll jump into the third lesson in the part 3.

 

Mohamed Meshref

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I am a normal person, who likes Physics, Meta-Physics, Space Exploring, reading, computer and game programming, and watching movies.

My knowledge includes:

C,C++, STL, Visual C++ and MFC, Visual Basic, Visual Basic.Net, .Net Windows Forms, Assembly, Java and Java Applets, ASP.Net, Game Programming with DirectX, Com ATL and WTL, Prolog, Data Structures and Algorithms, Win32 Programming, Win32 Hooking and Interception, Win32 Cracking and System Debugging, Windows Sockets and Networking, Proxy Chaining and Proxy Communications, GDI/GDI+, ADO.Net, Sql Server 2000, XML, Oracle Designer and Developer

Comments and Discussions

 
GeneralMy vote of 1 Pin
polygon20007-Oct-10 1:29
polygon20007-Oct-10 1:29 
GeneralMy vote of 1 Pin
pan05410-Jan-10 9:24
pan05410-Jan-10 9:24 
GeneralSome help is required Pin
Member 144183622-Nov-04 17:57
Member 144183622-Nov-04 17:57 
GeneralRe: Some help is required Pin
Mohamed Meshref22-Nov-04 18:53
Mohamed Meshref22-Nov-04 18:53 
GeneralRe: Some help is required Pin
Anonymous22-Nov-04 21:55
Anonymous22-Nov-04 21:55 
GeneralRe: Some help is required Pin
Anonymous22-Nov-04 21:59
Anonymous22-Nov-04 21:59 
GeneralRe: Some help is required Pin
Member 144183622-Nov-04 22:03
Member 144183622-Nov-04 22:03 
GeneralMy knowledge includes: --> Pin
Anonymous30-Aug-04 9:14
Anonymous30-Aug-04 9:14 
GeneralA few thoughts Pin
Michael P Butler30-Aug-04 4:30
Michael P Butler30-Aug-04 4:30 
GeneralF U C K, post sth on yr own code! Pin
Anonymous30-Aug-04 3:53
Anonymous30-Aug-04 3:53 
GeneralRe: F U C K, post sth on yr own code! Pin
Mohamed Meshref30-Aug-04 4:11
Mohamed Meshref30-Aug-04 4:11 
QuestionWhat are you trying to explain? Pin
WillemM28-Aug-04 23:27
WillemM28-Aug-04 23:27 
AnswerRe: What are you trying to explain? Pin
Mohamed Meshref29-Aug-04 0:13
Mohamed Meshref29-Aug-04 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.