I have an anti-aliasing issue. My goal is to render a texture on a "sheared rectangle" that is to say a parallelepiped. But with the code below, the vertical lines are pixellised. I tried with no success to change the glShadeModel, the glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); with GL_LINEAR, GL_NEAREST_MIPMAP_LINEAR, etc. In the "InitializeGL" sequence, I tried adding "glEnable(GL_POLYGON_SMOOTH);" but I guess it's for polygons and not textures. I found articles about using mip-mapping, or "close-up" filters, but did not understood how to code it in OpenGL. What is the best way to render a texture on a parallelepiped without aliasing ? Here below, you can see the "yTanAngle" that I had to obtain a shearing effect :
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textureId);
glBegin(GL_QUADS);
glColor4ub(255,255,255,incrustInfo->atexte);
glTexCoord2d(0.0, 0.0); glVertex2d(x0, y0);
glTexCoord2d(1.0, 0.0); glVertex2d(x1, y0);
glTexCoord2d(1.0,1.0); glVertex2d(x1 + yTanAngle, y1);
glTexCoord2d(0.0,1.0); glVertex2d(x0 + yTanAngle, y1);
glEnd();
glDisable(GL_TEXTURE_2D);
I also tried to apply a shearing matrix :
//--- Shearing
GLdouble shearing[16] = {1.0,0.0,0.0,0.0, tan(angle*M_PI/180.0),1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0};
glMultMatrixd(shearing);
But I still have a pixellised image. And another problem is that I want to apply this shearing only to this gl_quad, and not to the global matrix (all elements get sheared).
As asked by Nils Pipenbrinck, here is a screenshot (but it's done from a Windows screenshot saved to .BMP and loaded to freeimagehosting which provides a .PNG link ... however we can see the pixelisation of the flag):
(source: uploads.im)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
while creating the texture. Maybe it's what you want. – lisyarus