Have noticed an unexpected behavior of OpenGL (nVidia's card), when I try to map a texture on a 2D polygon. The image seems to be "broken" into 2 pieces:
Here's the source texture:
The simplified code snippet:
GLuint textId;
glGenTextures( 1, &textId );
glBindTexture( GL_TEXTURE_2D, textId );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, img.width(), img.height(), 0, GL_BGRA, GL_UNSIGNED_BYTE, (void*)img.bits() );
glEnable( GL_TEXTURE_2D );
glBegin( GL_TRIANGLE_FAN ); // the same effect for GL_QUADS
glTexCoord2d( 0.0, 0.0 );
glVertex2d( -0.5, -0.3 );
glTexCoord2d( 1.0, 0.0 );
glVertex2d( 0.5, -0.8 );
glTexCoord2d( 1.0, 1.0 );
glVertex2d( 0.5, 0.8 );
glTexCoord2d( 0.0, 1.0 );
glVertex2d( -0.5, 0.3 );
glEnd();
What is the cause for such a strange effect? I expect to see my texture just broadening from left to right, with the white lines remaining parallel.