I have mapped 2D textures on a quad....The problem is mapped texture is not looking in the right aspect ratio...It looks like a blurred image.......
for example....
My texture file is a BMP file of size 128*128
////////for loading the texture
AUX_RGBImageRec *TexImg[5];
string file[1];
file[0] = "texture//test.bmp";
/
memset(TexImg,0,sizeof(Tex
Img));
glGenTextures(1, texmap);
TexImg[0]= auxDIBImageLoadA((LPCSTR)f
ile[i].c_s
tr ());
glBindTexture(GL_TEXTURE_2
D, texmap[0]);
glTexImage2D(GL_TEXTURE_2D
,
0,
3,
TexImg[i]->sizeX,
TexImg[i]->sizeY,
0,
GL_RGB,
GL_UNSIGNED_BYTE,
TexImg[i]->data);
glTexParameteri(GL_TEXTURE
_2D,GL_TEX
TURE_MAG_F
ILTER,GL_L
INEAR);
glTexParameteri(GL_TEXTURE
_2D,GL_TEX
TURE_MIN_F
ILTER,GL_L
INEAR);
/*glTexParameteri(GL_TEXTU
RE_2D,GL_T
EXTURE_MAG
_FILTER,GL
_NEAREST);
glTexParameteri(GL_TEXTURE
_2D,GL_TEX
TURE_MIN_F
ILTER,GL_N
EAREST);*/
free(TexImg[0]->data);
free(TexImg[0]);
}
//*-------- End: Load Texture --------------
glEnable(GL_TEXTURE_2D);
glClearColor(0.0, 0.0, 0.0, 0.0);
glTexEnvf(GL_TEXTURE_ENV,G
L_TEXTURE_
ENV_MODE,G
L_MODULATE
);
//glTexEnvf(GL_TEXTURE_ENV
,GL_BLEND,
GL_MODULAT
E);
/* In the display function I have like this.....
glBindTexture(GL_TEXTURE_2
D, texmap[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 6.5, -7.52, -3); // V0 (0,0,0)
glTexCoord2f(1.0f, 0.0f); glVertex3f( -6.5, -7.52, -3); // V1 (1,0,0)
glTexCoord2f(1.0f, 1.0f); glVertex3f( -6.5, -7.52, -3); // V2 (1,1,0)
glTexCoord2f(0.0f, 1.0f); glVertex3f( 6.5, -7.52, -3); // V3 (0,1,0)
glEnd();
Do I have to map the texture on a quad as small tiles......so that my texture mapping on a quad looks perfect....? Any better solution.....
Start Free Trial