Game Development Reference
In-Depth Information
{
_textureManager = textureManager;
}
In Form.cs, that TextureManager will now need to be passed in to the Draw-
SpriteState constructor. The textures are easily accessible in the game state.
To use the texture, OpenGL needs to be told to start the texture mode, then
the texture is bound as the active texture. All vertices will use the currently bound
texture for their texture information. Finally, each vertex needs to have some
2D texture positions associated with it. Here it's just mapping from 0,0 to 1,1 so
the full texture is used.
This code sets the texture information for the first triangle of the quad. The result
can be seen in Figure 6.11.
Figure 6.11
Texture mapping half the quad.
 
Search WWH ::




Custom Search