views:

63

answers:

2

I am using code from this site: http://www.spacesimulator.net/tut4_3dsloader.html

It works in their example project but when I placed the code into a class for easier and more modular use, the texture fails to appear on the object.

I've double checked to make sure the texture ID is correct by debugging them side by side. On my project I get a blank white object while the example works fine.

Are there ANY ways to tell what is going on under the hood? Any error functions I can call that can give me some hint to what's going on? Right now I am just guessing. (Yes I have enabled 2D textures.

Thanks SO!

+1  A: 

glGetLastError()

or glGetError()

what ever it is...

make sure glEnable(GL_TEXTURE_2D);

and make sure your texture is bound using glBindTexture

make sure there are texture coords being rendered and that they are right (if they are all the same, or all the same uninitialized value you will get one colour across the whole thing)

ummm.... make sure your texture matrix isn't screwed... glMatrixMode(GL_TEXTURE); glLoadIdentity(); if your not using it...

then ummm....

make sure the data getting loaded in when you load the texture is right.

make sure if you have mipmapping on that you are loading in the mip maps, otherwise if you have the object at a different zoom you might not get any texture...

umm... thats all I can think of off the top of my head.

EDIT:

ooo, I just remembered one that caught me up once:

by changing the structure, you may have changed the initialization order of the app.

MAKE SURE you aren't trying to load textures BEFORE you initialize opengl (with the device contexts or whatever, I was under windows)

matt
The last sentence here was what I did. xD
bobber205
A: 

Make sure you're uploading a complete texture.

genpfault