I have an 512 by 512 image like this:
I mapped it to a 3D plane:
The location and perspective are all correct. But you can see that the edge is very jigsaw. Does not Open GL has anti-alias or I just did not turn it on?
Here is my code:
CGContextRef spriteContext = CGBitmapContextCreate(spriteData, spriteWidth, spriteHeight, 8, spriteWidth * 4, CGImageGetColorSpace(spriteImage), kCGImageAlphaPremultipliedLast);
CGContextTranslateCTM(spriteContext, 0, spriteHeight);
CGContextScaleCTM(spriteContext, 1, -1);
CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)spriteWidth, (CGFloat)spriteHeight), spriteImage);
CGContextRelease(spriteContext);
glDeleteTextures(1, &spriteTexture);
glGenTextures(1, &spriteTexture);
// Bind the texture name.
glBindTexture(GL_TEXTURE_2D, spriteTexture);
// Set the texture parameters to use a minifying filter and a linear filer (weighted average)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, spriteWidth, spriteHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, spriteData);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glClearColor(.0f, 0.0f, 0.0f, .0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Setup model view matrix
glMatrixMode(GL_MODELVIEW);
GLfloat teapot_vertices1[12];
glLoadMatrixf(m);
teapot_vertices1[0] = frames;
teapot_vertices1[1] = frameh;
teapot_vertices1[2] = 0;
teapot_vertices1[3] = frames + framel;;
teapot_vertices1[4] = frameh;
teapot_vertices1[5] = 0;
teapot_vertices1[6] = 0;
teapot_vertices1[7] = 0;
teapot_vertices1[8] = 0;
teapot_vertices1[9] = framel;
teapot_vertices1[10] = 0;
teapot_vertices1[11] = 0;
glVertexPointer(3 ,GL_FLOAT, 0, teapot_vertices1);
for(int i = 0; i < num_teapot_indices; i += new_teapot_indicies[i] + 1)
{
glDrawElements(GL_TRIANGLE_STRIP, new_teapot_indicies[i], GL_UNSIGNED_SHORT, &new_teapot_indicies[i+1]);
}
//glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];