Device.Device(Int32,DeviceType,IntPtr,CreateFlags,PresentParameters)
Device メソッド
使用例
- Direct3D デバイスの作成
オブジェクトの新しいインスタンスを初期化する。
定義
Visual Basic | Public Sub Device( _ ByVal adapter As Integer, _ ByVal deviceType As DeviceType, _ ByVal renderWindowHandle As IntPtr, _ ByVal behaviorFlags As CreateFlags, _ ByVal presentationParameters As PresentParameters _ ) |
C# | public Device( int adapter, DeviceType deviceType, IntPtr renderWindowHandle, CreateFlags behaviorFlags, PresentParameters presentationParameters ); |
Managed C++ | public: Device( int adapter, DeviceType deviceType, IntPtr renderWindowHandle, CreateFlags behaviorFlags, PresentParameters* presentationParameters ); |
JScript | public function Device( adapter : int, deviceType : DeviceType, renderWindowHandle : IntPtr, behaviorFlags : CreateFlags, presentationParameters : PresentParameters ); |
パラメータ
adapter | System.Int32. |
deviceType | Microsoft.DirectX.Direct3D.DeviceType. |
renderWindowHandle | System.IntPtr. |
behaviorFlags | Microsoft.DirectX.Direct3D.CreateFlags. |
presentationParameters | Microsoft.DirectX.Direct3D.PresentParameters. |
使用例
Direct3D デバイスの作成
この例では、レンダリングに使う Microsoft® Direct3D® Device およびデータ格納に使う VertexBuffer を作成する方法を示す。
- 作成される Device オブジェクトを利用すれば、多くのメソッド、プロパティ、イベントを使って、3D ポリゴン モデルのライティング、テクスチャ、シェーディング、レンダリングを制御できる。
- VertexBuffer オブジェクトは、モデルの頂点データのデータ格納リソースとして利用される。
この例では、ウィンドウの作成と操作用に、Vertices クラスが Form 型で宣言されている。
using Microsoft.DirectX.Direct3D;
.
.
.
public class Vertices : System.Windows.Forms.Form
{
// Global variables for this project
Device device = null; // 1. Create rendering device
VertexBuffer vertexBuffer = null; // 2. Create vertex buffer
PresentParameters presentParams = new PresentParameters();
public bool InitializeGraphics()
{
try
{
device = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, presentParams);
vertexBuffer = new VertexBuffer(
typeof(CustomVertex.PositionColored), 3, dev, 0,
CustomVertex.PositionColored.Format, Pool.Default);
pause = false;
return true;
}
catch { return false; }
}
// Call InitializeGraphics from Main...
}
対象
© 2002 Microsoft Corporation. All rights reserved. Terms of use.