Do not use on any
shared computer
September 6, 2008 02:12pm pdt
 
[x]
Attachment Details

2d texture mapping

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(TexImg));
glGenTextures(1, texmap);

TexImg[0]= auxDIBImageLoadA((LPCSTR)file[i].c_str ());
glBindTexture(GL_TEXTURE_2D, 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_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
/*glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);*/
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,GL_TEXTURE_ENV_MODE,GL_MODULATE);

//glTexEnvf(GL_TEXTURE_ENV,GL_BLEND,GL_MODULATE);


/* In the display function I have like this.....



glBindTexture(GL_TEXTURE_2D, 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 your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: jsbsudha
Question Asked On: 05.05.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by jsbsudha
Author Comment by jsbsudha:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by jsbsudha
Author Comment by jsbsudha:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by jsbsudha
Author Comment by jsbsudha:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by jsbsudha
Author Comment by jsbsudha:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by jsbsudha
Author Comment by jsbsudha:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Infinity08

Rank: Genius

Expert Comment by Infinity08:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628