Advertisement
1_2002 DirectX #109816

DirectX BASICS Tutorial part 2.0

This time I will try and teach Enumeration. Read my first article first before you read this (link given in this tutorial to first one). And learn something. Oh and post lots of feedback (and a vote or two ouldnt go amiss ;) )

AI

Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fonte
original-source
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./DirectX%208%202_files/filelist.xml">
<title>DirectX 8</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
 <o:Author> Thomas Waddell</o:Author>
 <o:LastAuthor> Thomas Waddell</o:LastAuthor>
 <o:Revision>2</o:Revision>
 <o:TotalTime>55</o:TotalTime>
 <o:Created>2001-06-15T20:37:00Z</o:Created>
 <o:LastSaved>2001-06-15T20:37:00Z</o:LastSaved>
 <o:Pages>3</o:Pages>
 <o:Words>1012</o:Words>
 <o:Characters>5769</o:Characters>
 <o:Lines>48</o:Lines>
 <o:Paragraphs>11</o:Paragraphs>
 <o:CharactersWithSpaces>7084</o:CharactersWithSpaces>
 <o:Version>9.3821</o:Version>
 </o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
	{font-family:"Arial Unicode MS";
	panose-1:2 11 6 4 2 2 2 2 2 4;
	mso-font-charset:128;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1 -369098753 63 0 4129023 0;}
@font-face
	{font-family:"\@Arial Unicode MS";
	mso-font-charset:128;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1 -369098753 63 0 4129023 0;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	color:windowtext;}
h1
	{mso-style-next:Normal;
	margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:1;
	font-size:22.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	color:navy;
	mso-font-kerning:0pt;
	font-weight:normal;
	text-decoration:underline;
	text-underline:single;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:center;
	mso-pagination:widow-orphan;
	font-size:22.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";
	color:navy;
	font-weight:bold;
	text-decoration:underline;
	text-underline:single;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
p
	{margin-right:0cm;
	mso-margin-top-alt:auto;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Arial Unicode MS";
	color:black;}
pre
	{margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Arial Unicode MS";
	color:black;}
@page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
@list l0
	{mso-list-id:622006920;
	mso-list-type:hybrid;
	mso-list-template-ids:1018734604 67698693 67698703 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0A7;
	mso-level-tab-stop:54.0pt;
	mso-level-number-position:left;
	margin-left:54.0pt;
	text-indent:-18.0pt;
	font-family:Wingdings;}
@list l0:level2
	{mso-level-tab-stop:90.0pt;
	mso-level-number-position:left;
	margin-left:90.0pt;
	text-indent:-18.0pt;}
@list l1
	{mso-list-id:1096636103;
	mso-list-type:hybrid;
	mso-list-template-ids:-1516219108 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>
</head>
<body lang=EN-GB link=blue vlink=purple style='tab-interval:36.0pt'>
<div class=Section1>
<p class=MsoTitle style='margin-left:18.0pt'><a name="_top"></a><span
style='font-weight:normal'>DirectX 8.0<o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left'><span
style='font-size:14.0pt;mso-bidi-font-size:12.0pt;font-weight:normal'>Contents:<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left'><span
style='font-size:14.0pt;mso-bidi-font-size:12.0pt;font-weight:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:54.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l0 level1 lfo2;tab-stops:list 54.0pt'><![if !supportLists]><span
style='font-size:12.0pt;font-family:Wingdings;color:windowtext;font-weight:
normal;text-decoration:none;text-underline:none'>§<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>Introduction<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:54.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l0 level1 lfo2;tab-stops:list 54.0pt'><![if !supportLists]><span
style='font-size:12.0pt;font-family:Wingdings;color:windowtext;font-weight:
normal;text-decoration:none;text-underline:none'>§<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>Enumerate adaptors<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:54.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l0 level1 lfo2;tab-stops:list 54.0pt'><![if !supportLists]><span
style='font-size:12.0pt;font-family:Wingdings;color:windowtext;font-weight:
normal;text-decoration:none;text-underline:none'>§<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>Hardware
enumeration<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:36.0pt;text-align:left'><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:36.0pt'><span style='font-weight:normal;
text-decoration:none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:36.0pt'><span style='font-weight:normal'>Introduction<o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:36.0pt'><span style='font-weight:normal;
text-decoration:none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle align=left style='text-align:left'><span style='font-size:
12.0pt;color:windowtext;font-weight:normal;text-decoration:none;text-underline:
none'>Before we begin,<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:36.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l1 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>If you haven&#8217;t
read my last tutorial then click <a
href="http://www.planetsourcecode.com/xq/ASP/txtCodeId.24086/lngWId.1/qx/vb/scripts/ShowCode.htm"><span
style='text-decoration:none;text-underline:none'>here</span></a> and read it
first. It will tell you how to begin and initialise DirectX.<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:36.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l1 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>I will assume a
reasonable knowledge of visual basic so if you don&#8217;t have a sound knowledge
then learn something easier and come back in a while.<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:36.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l1 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'>3.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>So you think you
have a reasonable knowledge of Visual Basic eh! Fine. Reference DirectX and
initialise it using the same set up as my last tutorial (see last tutorial.
DUH!).<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:36.0pt;text-align:left;
text-indent:-18.0pt;mso-list:l1 level1 lfo4;tab-stops:list 36.0pt'><![if !supportLists]><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'>4.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><![endif]><span style='font-size:12.0pt;color:windowtext;
font-weight:normal;text-decoration:none;text-underline:none'>Ok ready to begin
now<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left'><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left;
text-indent:18.0pt'><span style='font-size:12.0pt;color:windowtext;font-weight:
normal;text-decoration:none;text-underline:none'>If you like making games in
Visual Basic, like making cool effects for your apps, wanna make cool 3D
graphics, or are just interested then you have come to the right place, eh
site, eh tutorial, whatever it is. I&#8217;m not goanna go on, see the last
tutorial&#8217;s intro if you are interested. Infact, you should have already, even
just for the variable names and all.<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left'><span
style='font-size:12.0pt;font-weight:normal;text-decoration:none;text-underline:
none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt'><span style='font-weight:normal'>Enumeration
of the adaptors<o:p></o:p></span></p>
<p class=MsoTitle align=left style='margin-left:18.0pt;text-align:left'><span
style='font-size:12.0pt;font-weight:normal;text-decoration:none;text-underline:
none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt;text-align:justify'><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'><span style='mso-tab-count:1'>      </span>Ok
basically, enumeration is a big part of making a DirectX app. It enables you to
find out programmatically what type of graphics and sound cards your users
have, what they can handle, the drivers they use, the software available, how
fast a PC they have and the resolution of the screen. All this is essential to
making a distributable app. After all DirectX (8.0. especially) relies much on
the hardware and driver capabilities.<o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt;text-align:justify'><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt;text-align:justify'><span
style='font-size:12.0pt;color:windowtext;font-weight:normal;text-decoration:
none;text-underline:none'><span style='mso-tab-count:1'>      </span>First and
most important is to determine what display mode set-up the hardware supports.
This is only concerned with full screen, not windowed mode. First you must
query the available adaptor-device combination</span><span style='font-size:
12.0pt;mso-bidi-font-size:10.0pt;color:windowtext;font-weight:normal;
text-decoration:none;text-underline:none'> for the resolutions it supports and
the hardware capabilities. So, first off I'll show you how to enumerate the
adapters.<o:p></o:p></span></p>
<p class=MsoTitle style='margin-left:18.0pt;text-align:justify'><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;color:windowtext;font-weight:
normal;text-decoration:none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<pre style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'>'D3D should be a valid reference to a Direct3D8 object.<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'>'AdapterInfo should be a defined D3DADAPTER_IDENTIFIER8 variable</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Private</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Sub</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> EnumerateAdapters()<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Dim</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> I </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Integer</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>, sTemp </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>String</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>, J </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Integer</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">    </span>'This'll either be 1 or 2<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span>nAdapters = D3D.GetAdapterCount<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>For</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> I = 0 </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>To</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> nAdapters - 1<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">        </span>'Get the relevant Details<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span>D3D.GetAdapterIdentifier I, 0, AdapterInfo<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">        </span>'Get the name of the current adapter - it's stored as a long<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">        </span>'list of character codes that we need to parse into a string<span style="mso-spacerun: yes">  </span>- Don&#8217;t ask me why they did it like this.</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span>sTemp = &quot;&quot; </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#339966'>'Reset the string ready for our use</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#99CC00'><o:p></o:p></span></pre><pre style='text-align:justify'><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">      </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style='mso-tab-count:1'>               </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>For</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> J = 0 To 511<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">            </span><span
style='mso-tab-count:1'>   </span><span style="mso-spacerun: yes">          </span>sTemp = sTemp &amp; Chr$(AdapterInfo.Description(J))<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style='mso-tab-count:1'>               </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Next</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> J</span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span><span
style='mso-tab-count:1'>       </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style='mso-tab-count:1'>               </span>sTemp = Replace(sTemp, Chr$(0), &quot; &quot;)<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span><span
style='mso-tab-count:1'>       </span>cmbAdapters.AddItem sTemp<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Next</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> I<o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman";color:blue'>End Sub<o:p></o:p></span></pre>
<p class=MsoTitle style='margin-left:18.0pt;text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:"Arial Unicode MS";
color:black;text-decoration:none;text-underline:none'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>Now that we can
identify the adapter we can look at what devices it'll support. Software
renderers are an advanced topic and are unlikely to be relevent yet so we'll
ignore them for now. Instead we'll check if the hardware supports HAL (Hardware
Accelaration). The reference rasterizer should always be present so we'll just
assume that we can access it.</span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<pre style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Private</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Sub</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> EnumerateDevices()<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>On</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Local</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Error</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Resume</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Next</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#006600'> 'We want to handle the errors...</span><span style='font-size:
12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Dim</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> Caps </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> D3DCAPS8<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>D3D.GetDeviceCaps cmbAdapters.ListIndex, D3DDEVTYPE_HAL, Caps<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> Err.Number = D3DERR_NOTAVAILABLE </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">        </span>'There is no hardware acceleration<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span>cmbDevice.AddItem &quot;Reference Rasterizer (REF)&quot;</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#006600'> 'Reference device will always be available</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Else</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">        </span>cmbDevice.AddItem &quot;Hardware Acceleration (HAL)&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span>cmbDevice.AddItem &quot;Reference Rasterizer (REF)&quot;</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#006600'> 'Reference device will always be available</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>End</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre>
<p style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-family:"Times New Roman";color:blue'>End</span><span
style='font-family:"Times New Roman"'> </span><span style='font-family:"Times New Roman";
color:blue'>Sub</span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-family:"Times New Roman"'><br>
</span><span style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>Above
is a slightly sloppy way of detecting hardware support - but it works and is
very simple. If we attempt to read stuff from a HAL device and it doesn't exist
then we'll get the error code &quot;D3DERR_NOTAVAILABLE&quot;, at which point
we know that only the REF device is okay to use. The code outputs the results
to a combobox, which you can change if you want...</span><span
style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>The last thing
that we want to be able to check is what display modes are supported. This can
only be done when we've selected an adapter and a device (Add a combobox called
&#8220;Cmbres&#8221;.</span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<pre style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Private</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Sub</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> EnumerateDispModes(Renderer </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Long</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>)<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>cmbRes.Clear</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#006600'> '</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman";color:#339966'>Remove any existing entries...</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Dim</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> I </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Integer</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>, ModeTemp </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>As</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> D3DDISPLAYMODE<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>nModes = D3D.GetAdapterModeCount(cmbAdapters.ListIndex)<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>For</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> I = 0 To nModes - 1</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#339966'> 'Cycle through them and collect the data...</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Call</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> D3D.EnumAdapterModes(cmbAdapters.ListIndex, I, ModeTemp)<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">    </span>'First we parse the modes into two catergories - 16bit and 32bit<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> ModeTemp.Format = D3DFMT_R8G8B8 </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Or</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> ModeTemp.Format = D3DFMT_X8R8G8B8 </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Or</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> ModeTemp.Format = D3DFMT_A8R8G8B8 </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">  </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:#339966'><span style="mso-spacerun: yes">      </span>'Check that the device is acceptable and valid...<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> D3D.CheckDeviceType(cmbAdapters.ListIndex, Renderer, ModeTemp.Format, ModeTemp.Format, </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>False</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'>) &gt;= 0 </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>Then</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:#339966'><span style="mso-spacerun: yes">            </span>'then add it to the displayed list<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">            </span>cmbRes.AddItem ModeTemp.Width &amp; &quot;x&quot; &amp; ModeTemp.Height &amp; &quot; 32 bit&quot; &amp; &quot;<span style="mso-spacerun: yes">    </span>[FMT: &quot; &amp; ModeTemp.Format &amp; &quot;]&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>End</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Else</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">        </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> D3D.CheckDeviceType(cmbAdapters.ListIndex, Renderer, ModeTemp.Format, ModeTemp.Format, False) &gt;= 0 </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">            </span>cmbRes.AddItem ModeTemp.Width &amp; &quot;x&quot; &amp; ModeTemp.Height &amp; &quot; 16 bit&quot; &amp; &quot;<span style="mso-spacerun: yes">    </span>[FMT: &quot; &amp; ModeTemp.Format &amp; &quot;]&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">        </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>End</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span></span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>End</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'> </span><span style='font-size:12.0pt;
mso-bidi-font-size:10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Next</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> I<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>cmbRes.ListIndex = cmbRes.ListCount - 1<o:p></o:p></span></pre>
<p class=MsoNormal style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='color:blue'>End</span> <span style='color:blue'>Sub<o:p></o:p></span></p>
<p class=MsoNormal align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><u><span
style='font-size:22.0pt;mso-bidi-font-size:12.0pt;color:navy'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></u></p>
<h1 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Enumeration
of the Hardware</h1>
<p style='text-indent:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>The final
useful part is to determine what features the hardware supports. This is particularly
useful if you want to use a special feature that is hardware dependent and not
very common yet (i.e., at the cutting edge of technology). Capability
enumeration is very simple, but there are 100's (maybe 1000's) or things you
can check for.</span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>The first stage
is to actually retrieve the information, this is incredibly simple:</span><span
style='font-family:"Times New Roman"'><br>
</span><span style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>Now
that we have a structure holding all the information (&quot;Caps&quot;) we can
query it for what we would like to know. </span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<p style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'>Following are
some example of how to get information on the hardware capabilities (Add a list
box).</span><span style='font-family:"Times New Roman"'><o:p></o:p></span></p>
<pre style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> Caps.MaxActiveLights = -1 </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">    </span>List1.AddItem &quot;Maximum Active Lights: Unlimited&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>Else</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span>List1.AddItem &quot;Maximum Active Lights: &quot; &amp; Caps.MaxActiveLights<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>End</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'>List1.AddItem &quot;Maximum Point Vertex size: &quot; &amp; Caps.MaxPointSize<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>List1.AddItem &quot;Maximum Texture Size: &quot; &amp; Caps.MaxTextureWidth &amp; &quot;x&quot; &amp; Caps.MaxTextureHeight<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'>List1.AddItem &quot;Maximum Primatives in one call: &quot; &amp; Caps.MaxPrimitiveCount<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> Caps.TextureCaps And D3DPTEXTURECAPS_SQUAREONLY </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then<o:p></o:p></span></pre><pre style='text-align:justify'><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'><span style="mso-spacerun: yes">    </span>List1.AddItem &quot;Textures must always be square&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>End</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> Caps.TextureCaps And D3DPTEXTURECAPS_CUBEMAP </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">    </span>List1.AddItem &quot;Device Supports Cube Mapping&quot;<o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>End</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>If</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></pre><pre
style='text-align:justify'><span style='font-size:12.0pt;mso-bidi-font-size:
10.0pt;font-family:"Times New Roman";color:blue'>If</span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman"'> Caps.TextureCaps And D3DPTEXTURECAPS_VOLUMEMAP </span><span
style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:"Times New Roman";
color:blue'>Then</span><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;
font-family:"Times New Roman"'><o:p></o:p></span></pre><pre style='text-align:
justify'><span style='font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:
"Times New Roman"'><span style="mso-spacerun: yes">    </span>List1.AddItem &quot;Device Supports Volume Mapping&quot;<o:p></o:p></span></pre>
<p class=MsoNormal style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='color:blue'>End</span> <span style='color:blue'>If<o:p></o:p></span></p>
<p class=MsoNormal style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='color:blue'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>
<p class=MsoNormal style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
<p class=MsoNormal style='text-align:justify;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Again
please leave feedback 9and a vote or two might be quite nice too ;) ) Look out
for future Tutorials and if you want to E mail me then do so <a
href="mailto:thomas.waddell@cableinet.co.uk?subject=DirectX%208.0%20Tut%202.0">here</a>.
CYA ;) </p>
</div>
</body>
</html>
Comentários originais (3)
Recuperado do Wayback Machine