PDA

View Full Version : Texture Wrapping



Manel Goucha
11-22-2011, 07:58 PM
Hi, I'm using an OpenGl primitive with a texture using an Image and I want it to be repeated or simple depending on the object I'm drawing.

Example:

I have this code:



glTranslate(0, 0, 0);
glRotate(A, 0, 0, 1);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Image);

glBegin(GL_TRIANGLE_FAN);
glNormal3f(0, 0, 1);
glTexCoord2f(0, 0.1); glVertex2f( - 10, - 10);
glTexCoord2f(1, 0.1); glVertex2f( + 10, - 10);
glTexCoord2f(1, 1.1); glVertex2f( + 10, + 10);
glTexCoord2f(0, 1.1); glVertex2f( - 10, + 10);
glEnd;

glRotate(-A, 0, 0, 1);
glDisable(GL_TEXTURE_2D);
glTranslate(-0, -0, -0);

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL _CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL _CLAMP);


My problem is that everytime I draw an array of images, it gets repeated even with GL_CLAMP but only the first time its drawn with a blinking effect.

I'm using a 100 x 100 image with (0, 0.1) offset

this is the problem:
Video (http://www.youtube.com/watch?v=2lsB_xErw-E)

I really apreciate anyone that can help me

V-man
11-23-2011, 02:02 AM
http://www.opengl.org/wiki/Common_Mistakes#Texture_edge_color_problem