User Submitted Code Samples - Page 1

Initialization (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to initialize the Direct3D component of DirectX 9.0c SDK.

Relevant VB .NET Keywords: System.Windows.Forms.Form, SetStyle, ControlStyles.AllPaintingInWmPaint, ControlStyles.Opaque, BackBufferCount, AutoDepthStencilFormat, EnableAutoDepthStencil, DeviceWindowHandle, SwapEffect, SwapEffect.Flip, Windowed, BackBufferWidth, BackBufferHeight, BackBufferFormat, Format.R5G6B5, Format.X8R8G8B8, PresentationInterval, PresentInterval.Immediate, DeviceType.Hardware, CreateFlags.HardwareVertexProcessing, Clear, BeginScene, EndScene, and Present.

 

Primitive Types (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to use the six rendering primitives of Direct3D: point list, line list, line strip, triangle list, triangle strip, and triangle fan.

Relevant Keywords: ZBufferEnable, Lighting, ShadeMode, ShadeMode.Gouraud, Transform.World, Transform.View, Transform.Projection, Matrix.Identity, Matrix.LookAtLH, Vector3, Matrix.PerspectiveFovLH, CSng, Math.PI, CustomVertex.TransformedColored, ToArgb, PrimitiveType.PointList, PrimitiveType.LineList, PrimitiveType.LineStrip, PrimitiveType.TriangleList, PrimitiveType.TriangleStrip, PrimitiveType.TriangleFan, and DrawUserPrimitives.

 

Creating Mesh Objects (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to load a Direct3D Mesh object with the vertex data for a textured cube.

Relevant Keywords: ExtendedMaterial, Mesh, Mesh.FromFile, MeshFlags.Managed, TextureLoader.FromFile, Material, SetTexture, and DrawSubset.

 

Creating Textures (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to create a Direct3D Texture object.

Relevant Keywords: TextureLoader.FromFile, Format.Unknown, Pool.Managed, Filter.Linear, DrawUserPrimitives, and SetTexture.

 

Lighting (DirectX 9.0 - VB .NET)
 

Author: RobyDX

Demonstrates how to setup the three basic light types of Direct3D lighting: directional, point and spot.

Relevant Keywords: RenderState.Lighting, Lights(0).Enabled, Lights(0).Type, Lights(0).Diffuse, Lights(0).Direction, Lights(0).Update(), Lights(0).Range, Lights(0).Attenuation1, Lights(0).InnerConeAngle, Lights(0).OuterConeAngle, Material, SetTexture, DrawSubset, LightType.Directional, LightType.Point, and LightType.Spot.