Texture mapping help?

Ok, can anybody please tell me why i cannot texture map anything in my application. I am loading opengl from within a library i have created. then when trying to display any object with texture mapping, i just simply get the shape with the most recent color selected…

What are the obvious reasons for this??


Defualt minification filtering is GL_NEAREST_MIPMAP_LINEAR. If you didn’t specify a mipmap chain your texture unit stays off. Use glTexParameteri to switch to GL_LINEAR or GL_NEAREST.

This is the section i think you mean…



Tried both ways as you can see, any other ideas?

Does your texture have power of two dimensions?

Are you trying to load the texture before you have a rendering context?

Are you loading the data from the file correctly?

These are just a few questions that come to mind. We’d need to see your code to give better answers.

Yes it does seem like i am trying to load the textures prior to setting the rendering context.

What would be the explanation why this didn,t work?

I have the same problem when i followed the codes written on a tutorial website.

But i solved it when i added:

gluBuild2DMipmaps(GL_TEXTURE_2D, 3,ImageWidth,ImageHeight, GL_RGBA, GL_UNSIGNED_BYTE, ImageBuffer);

after glTexImage2D() command.

DId u omit that sentence?

Nope, I had that there. Thanks all for your help, its now sorted by making sure i create the textures after setting up the rendering context.


Just for the record,
is not an option, magnification allows only GL_NEAREST and GL_LINEAR and your code throws a GL error. There is no bigger texture than level of detail 0 to mipmap with.