I completed to load a .tga file in cpp&opengl. The fallowing code is successful.
…
glRasterPos2i(0,0);
glDrawPixels…
…
And I tried same .tga file to do texture mapping on the following codes,(I used same loader code) it didn’t run :
I try to solve problem.
1-) Pixel number is more than the object size. Is it a problem?
2-) There isn’t a load error on program, but object is not covered with .tga. What can be the problem?
Have you bound your texture with glBindTexture? Did you also enable the texture with glEnable(GL_TEXTURE_2D)? You also need to set the minification and the magnification filters for the texture. Do you get any gl errors? You could check that for instance with GLIntercept.
I will check glBindTexture.
Actually, second code runs with different .tga file which has same dimensions with object.
I used glEnable(GL_TEXTURE_2D) already.
There is not any error. But object surface is blank.
???
Can you post the whole code? I think that you are loading your texture in a wrong way… Also, on older cards texture size has to be a power-of-two, like 256x256 or 512x512 etc… The texture-to-object size ratio plays no role here