I'm looking at NeHe's texture mapping tutorial. It looks overly complicated for just loading a texture.
Is there a way to load a texture in SFML and then use it in Open GL? I use SFML for my windowing.
Welcome to OpenGL, where the fast things come for free and the easy things are made hard.
If you thought that sample was long and complicated, "just for loading a texture", then you've seen nothing yet. Wait until you have to load DDS textures, process HDR textures, support cubemaps, render to a texture, etc.
Loading a texture in OpenGL consists of two components:
The first part should be easy, because SFML comes with a standard image loader.
Next, we'll have to generate an OpenGL texture object.
There are a number of choices for binding a texture. There are the three main types: 1D, 2D and 3D and you have support for cubemaps (+X, -X, +Y, -Y, +Z, -Z). However, in 99% of the cases, you will want a 2D texture.
Now we get to the interesting part. Let's upload our data to the video card.
Finally, we can set a number of texture parameters. These answer questions like: what if we use a texture coordinate that is outside of the range (0.0, 1.0)? Do we wrap around (
And now you should be able to bind your texture using
SFML 2.0+ makes it even easier to load a texture;