Hello everyone!
I have found a really weird result when I display a 2D texture (with GL_QUAD) on the screen at a different size to what it normally is:
E.G when I display a 64x32 image(texture) on the screen at 128x64 and it contains an alpha channel the pixelated borders seem to obtain a grey-ish border?
This is the initializing functions I use openGL wise:
glEnable(GL_TEXTURE_2D);
glClearColor(0.70f, 0.70f, 0.70f, 0.0f);
glClearDepth(1.0f);
GLint iViewport[4];
glGetIntegerv( GL_VIEWPORT, iViewport );
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glOrtho(iViewport[0], iViewport[0]+iViewport[2],iViewport[1]+iViewport[3], iViewport[1], -1, 1 );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_LIGHTING_BIT );
glDisable( GL_DEPTH_TEST );
glDisable( GL_LIGHTING );
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glColor4f(1.0f,1.0f,1.0f,1.0f);
And this is my displaying function:
glBindTexture(GL_TEXTURE_2D,Tile_Texture);
glBegin(GL_QUADS);
glEnable(GL_TEXTURE_2D);
glTexCoord2f( 0.0, 0.0); glVertex2f(0,0);
glTexCoord2f( 1.0, 0.0); glVertex2f(128,0);
glTexCoord2f( 1.0, 1.0); glVertex2f(128,64);
glTexCoord2f( 0.0, 1.0); glVertex2f(0,64);
glDisable(GL_TEXTURE_2D);
glEnd();
And if you need a diagram, this is a photo of it happening:
(see attachment).
I hope I have provided enough information and I can provide more if necessary.
Thanks in advance!
Will,