Advertisement

05.05.2008 at 07:20AM PDT, ID: 23376460 | Points: 500
[x]
Attachment Details

2d texture mapping

Asked by jsbsudha in C++ Programming Language, 3D Game Programming, OpenGL Graphics & Game Programming

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 Free Trial
[+][-]05.05.2008 at 07:35AM PDT, ID: 21500316

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 07:36AM PDT, ID: 21500321

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 08:22AM PDT, ID: 21500658

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 09:26AM PDT, ID: 21501109

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 10:20AM PDT, ID: 21501455

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 10:28AM PDT, ID: 21501526

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.05.2008 at 10:37AM PDT, ID: 21501585

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 12:00AM PDT, ID: 21505246

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 12:05AM PDT, ID: 21505270

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 12:09AM PDT, ID: 21505299

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 01:20AM PDT, ID: 21505564

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628