Loading a Texture |
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"); }
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center