, Visual C#


- 7


Color.White, 1.0f, 0);

// :

myDevice.BeginScene();

// (world, view, projection):

SetupMatrices();

 

// :

myDevice.SetTexture(0, myTexture);

myDevice.TextureState[0].ColorOperation =

TextureOperation.Modulate;

myDevice.TextureState[0].ColorArgument1 =

TextureArgument.TextureColor;

myDevice.TextureState[0].ColorArgument2 =

TextureArgument.Diffuse;

myDevice.TextureState[0].AlphaOperation =

TextureOperation.Disable;

// :

myDevice.SetStreamSource(0, myVertexBuffer, 0);

myDevice.VertexFormat =

CustomVertex.PositionNormalTextured.Format;

myDevice.DrawPrimitives(

PrimitiveType.TriangleStrip, 0, (4 * 25) - 2);

// :

myDevice.EndScene();

// :

myDevice.Present();

}

//

// Form1:

protected override void OnResize(System.EventArgs e)

{

myPause = ((this.WindowState ==

FormWindowState.Minimized) || !this.Visible);

}

// Form1 Esc:

protected override void OnKeyPress(KeyPressEventArgs e)

{

if ((int)(byte)e.KeyChar == (int)Keys.Escape)

this.Close();

}

Form1.cs ( Program.cs) Main, .

45.4. .

using (Form1 myForm1 = new Form1())

{

if (!myForm1.InitializeDirectX())

{

MessageBox.Show(" DirectX.");

return;

}

// Form1:

myForm1.Show();

// Form1:

while (myForm1.Created)

{

myForm1.myRendering();

Application.DoEvents();

}

}

Visual C# DirectX .