Texture Mapping C++ OpenGL

Jim picture Jim · Nov 27, 2010 · Viewed 14.7k times · Source

I have read around on this, including Nehe and here for solutions, but I cant find a specific answer.

I am trying to load a a photo, called stars.jpg. I want to make this my background of the scene, by mapping it using uv coordinates, doing it by

glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2f(0,0);

However I am just very confused about how to load the actual textures in, all the calls for

glActiveTexture();
glEnable(GL_TEXTURE_2d);
glBindTexture(GL_TEXTURE);

All they do is confuse me, what do all these mean/do, and in what order am I suppose to put these in, in order to get the stars.jpg to be my background?

Answer

Kos picture Kos · Nov 27, 2010

Your number-one tool for loading textures in OpenGL is the Simple OpenGL Image Loader (SOIL) library. You just need to pass the filename and some flags and you'll get your texture ID.

Also, you're learning very old and outdated version of OpenGL now - you might want to have a google for newer tutorials or browse the specs whenever you feel ready.