View Full Version : Texture mapping help?
nevans06
03-04-2004, 01:12 AM
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??
thanks.
Relic
03-04-2004, 01:44 AM
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.
nevans06
03-04-2004, 02:04 AM
This is the section i think you mean....
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR_MIPMAP_NEAREST);
//glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
Tried both ways as you can see, any other ideas?
chowe6685
03-04-2004, 03:11 AM
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.
nevans06
03-04-2004, 03:21 AM
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?
Lanfear
03-04-2004, 03:32 AM
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?
nevans06
03-04-2004, 03:39 AM
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.
Cheers!
Relic
03-04-2004, 08:27 AM
Just for the record,
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR_MIPMAP_LINEAR);
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.