Last Updated November 2, 2012
Check out my texture mapping notes for an overview of texture mapping principles
Use SFML's Image class to load the picture file;
We need to ask OpenGL to generate a texture object for every texture we are going to use in the app.
The function glGenTextures(...) generates a texture object. We will use the integer as a texture ID
Set current texture (the following texture operations apply to current texture). We will nedd to do this every time we change textures.
Need to tell OpenGL how filtering is to be applied. There are two categories of filtering;
The texture data is stored internally within the OpenGL system (possibly on a graphics card). This phase takes the bitmap data and stores it as a texture.
If we are using Mipmaps, then we need to call this function once for each mipmap, changing the mipmap level number appropriately.
Before we draw anything, must turn on texturing;
This code creates a quad, associating the vertices of the quad with the corners of the texture;
Download this project to see it in action
© Ken Power 1996-2016