
XNA Game Studio Express provides a number of helpful how-to guides. One such guide demonstrates the use of the framework's default material class "BasicEffect" to render a cube using 3D primitives.
When you run the sample code, you will see a colored cube rendered on screen (seen on the right).
That great. So now how do you render a bitmap textured cube?
Initially, I got a black cube instead of the expected rendered one. After tinkering around, I have managed to load a bitmap and assigned it to the basic effect material.
Here are a couple of learning points:
- To use bitmap textures, you need to :
- Assign a loaded texture to the BasicEffect.Texture property
- Enable texture rendering, set BasicEffect.TextureEnabled to true
- The framework calls Initialize() before LoadGraphicsContent(). Hence you should only assign your texture reference to the basic-effect material after you have loaded the bitmap.
(UseBasicEffect.zip).Please let me know if the link works and other comments.
1 comments:
Confirmed--The link works. Thanks for the content☺
Post a Comment