In the image below, the left texture is a POT texture - if the coordinates of the texture go beyond [0,1], the extreme pixels are repeated. This is what I would expect.

But the same exact code when rendering NPOT texture does not apply only to the extreme pixels only on the right edge.
Why do they behave differently?
[EDIT]
So that I would not make a mistake, I replaced the rendering code with a simple test code.
GLboolean glEnable2d = 0;
GLboolean glEnableRect = 0;
glGetBooleanv(GL_TEXTURE_2D, &glEnable2d);
glGetBooleanv(GL_TEXTURE_RECTANGLE_ARB, &glEnableRect);
if (texWidth == 1.0 && texHeight == 1.0) {
if (glEnableRect) {
printf("GL_TEXTURE_RECTANGLE_ARB is ENABLED!\n");
}
printf("TEX 2D: width = %.3f, height = %.3f\n", texWidth, texHeight);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} else {
if (glEnable2d) {
printf("GL_TEXTURE_2D is on!\n");
}
printf("TEX RECT: width = %.3f, height = %.3f\n", texWidth, texHeight);
glTexParameterf(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
glBegin(GL_QUADS);
if (drawBeyondEdge) {
glTexCoord2f(0.0 * texWidth, 1.0 * texHeight);
glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0 * texWidth, 1.0 * texHeight);
glVertex3f(+1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0 * texWidth, 0.0 * texHeight);
glVertex3f(+1.0f, +1.0f, 0.0f);
glTexCoord2f(0.0 * texWidth, 0.0 * texHeight);
glVertex3f(-1.0f, +1.0f, 0.0f);
} else {
glTexCoord2f(-1.0 * texWidth, 2.0 * texHeight);
glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(2.0 * texWidth, 2.0 * texHeight);
glVertex3f(+1.0f, -1.0f, 0.0f);
glTexCoord2f(2.0 * texWidth, -1.0 * texHeight);
glVertex3f(+1.0f, +1.0f, 0.0f);
glTexCoord2f(-1.0 * texWidth, -1.0 * texHeight);
glVertex3f(-1.0f, +1.0f, 0.0f);
}
glEnd();
And this is the result that he produced, with a POT texture on the left and an NPOT texture on the right.
