Original Post
Hi! I'm trying to render a quad using a texture of a ring. The ring has some alpha fading around the edges to smooth it out. Great. However, when I try to render it I get some weird artifacts where the alpha pixels are. They render much darker than they should creating some dark spots around the edge of the ring. I've debugged it down to the min / mag filter I'm using ( GL_LINEAR ). This seems to be the culprit. However, when I try changing it to GL_NEAREST...the problem goes away but the image is now super blocky and very ugly looking :( Does anyone have a way to fix this problem? Any help would be great! Here is my gl setup code ( the important ones ): And when I load a texture in: Thanks!
glShadeModel( GL_SMOOTH );
glClearColor( 1.0f, 1.0f, 1.0f, 1.0f );
glClearDepth( 1.0f );
glDisable( GL_DEPTH_TEST );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glEnable( GL_TEXTURE_2D );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glGenTextures( 1, &textureId );
glBindTexture( GL_TEXTURE_2D, textureId );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
glBindTexture( GL_TEXTURE_2D, NULL );