PDA

View Full Version : GL_BLEND problem.



manking
03-12-2013, 01:28 AM
Can you help me with some problem?


I use FTGL font library to draw font.
Then i draw font in FBO texture.
Then drawing FBO texture. But when i draw FBO textures, they not exactly(pixel to pixel) the same that FTGL renders.

I cant load image to this forum.
link- image.openlan.ru/images/32006137409350243222.png

On image :

#1 - this code
glColor4f(1,1,1,1.0f);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, id);
glBegin(GL_QUADS);
glTexCoord2d(0,1); glVertex3i(point1.X , point1.Y , point1.Z);
glTexCoord2d(1,1); glVertex3i(point2.X , point2.Y , point2.Z);
glTexCoord2d(1,0); glVertex3i(point3.X , point3.Y , point3.Z);
glTexCoord2d(0,0); glVertex3i(point4.X , point4.Y , point4.Z);
glEnd();

glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);




#2 - The above code with comment lines.

//glEnable(GL_ALPHA_TEST);
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glDisable(GL_BLEND);
//glDisable(GL_ALPHA_TEST);



#3 - FTGL texture font library draw(source code)


if(activeTextureID != glTextureID)
{
glBindTexture(GL_TEXTURE_2D, (GLuint)glTextureID);
activeTextureID = glTextureID;
}

dx = floor(pen.Xf() + corner.Xf());
dy = floor(pen.Yf() + corner.Yf());
glBegin(GL_QUADS);
glTexCoord2f(uv[0].Xf(), uv[0].Yf()); glVertex3f(dx, dy , Z);
glTexCoord2f(uv[0].Xf(), uv[1].Yf()); glVertex3f(dx, dy - destHeight , Z);
glTexCoord2f(uv[1].Xf(), uv[1].Yf()); glVertex3f(dx + destWidth, dy - destHeight , Z);
glTexCoord2f(uv[1].Xf(), uv[0].Yf()); glVertex3f(dx + destWidth, dy , Z);
glEnd();





#1 In the letter 'F'. Deleted all transparent pixels that have at #2 and #3.
But #2 don't have transparent.

V-man
03-12-2013, 08:01 AM
#1 In the letter 'F'. Deleted all transparent pixels that have at #2 and #3.
But #2 don't have transparent.

#1 looks pixel perfect. There is no aliasing.
#2 and #3 look like they have aliasing, probably due to texture filter settings (GL_LINEAR?)