View Full Version : Screensaver Textures

01-06-2004, 10:42 AM
This is my first post here, so hopefully it is in the right place. I've read the Red Book, and worked through some of NeHe's tutorials. I was able to use six separate textures on his sixth tutorial (though probably not in the most efficient way).

I started working on turning the spinning cube in to a screensaver today using LanceUSA's tutorial code (found at http://www.lanceusa.com/Screen_Saver_Tutorial.html), but all I get now is a spinning white cube. The code is a bit messy, so I thought I'd just give the basic gist of what I attempted. I took Lance's code, and added the LoadGLTextures (with my modifications)and LoadBMP functions from NeHe's tutorial. The screensaver part seems to be working, but I can't figure out why my textures aren't mapping to the cube.

Any suggestions? I'm still new to OpenGL, so please keep that in mind. Any help would be greatly appreciated.

01-06-2004, 11:25 AM
Make sure, that you already have a gl context when you load the textures.

Use gluBuild2DMipmaps, it prevents you from using non-power-of-two textures (it rescales them) and it builds mipmaps for you, so you canīt forget to do that.

glBindTexture is not allowed between glBegin / glEnd calls, check for that.

Check for glErrors, certainly it will tell you, that you did something wrong.
This way you get a nice error-string:

GLenum errCode = glGetError ();
if (errCode != GL_NO_ERROR)
const GLubyte *errString;
errString = gluErrorString(errCode);

And, of course, donīt forget, to enable texturing.

Thatīs all i can think of at the moment.


01-07-2004, 02:34 AM
This could also be a non-GL related error: are the texture files located in a directory that the program can find?