Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
With Microsoft DirectX 9.0 for Managed Code, it is relatively simple to load a texture. The following C# code example does just that. To load a texture using DirectX 9.0 for Managed Code, it is first necessary to create a valid Device and a Texture object.
[C#]
using Microsoft.DirectX.Direct3D;
.
.
.
// Global variables for this project.
Device device = null; // Rendering device.
Texture texture = null;
// Initialize the device.
.
.
.
// Device reset method.
public void OnResetDevice(object sender, EventArgs e)
{
Device dev = (Device)sender;
// Now create the texture.
texture = TextureLoader.FromFile(dev, Application.StartupPath +
@"\..\..\banana.bmp");
}