Enabling blending clips texture ?

I use the following to render a texture font to an fbo(which I later render to another fbo):


glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
..
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0f, width, height,0f, -1f, 1f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);	

glClear(GL_COLOR_BUFFER_BIT);  // (0f,0f,0f,0f)

glDisable(GL_BLEND);
glWrite(0f, i*16f, line);
glEnable(GL_BLEND);

glViewport( 0, 0, vPort[2], vPort[3]);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
..

With the above code all the letters miss the right 4 pixels. The letters appear in full when gldisable is commented out. Why is this? :stuck_out_tongue: (the letters are on the same pixels both ways)
Thanks.

glWrite just needs an x, y and a line (char[]) and works like a charm everywhere except on that fbo when blending is disabled.

glWrite is alike nehe’s texture font write function.

What could disabling blending do to make part of the letters(textures) not show up?

Why the 4 pixels still showed up is still a mystery to me, but here the solution:

In stead of glDisable(GL_BLEND), using glBlendFunc(GL_ONE,GL_ONE) worked like a charm :slight_smile:

What does disabling blending exactly do? does set rendering to ignore the alpha channel?

When you disable blending, newly computed fragments color will replace the last fragments color stored in the framebuffer. When you enable blending, incoming fragments color can be blended with the fragment color that are already in the framebuffer using the operation set with glBlendFunc.

Using GL_ONE as source and destination will add the incoming fragment color to the one already stored in the framebuffer. You may quickly obtain saturated renderings.

If you use glBlendFunc(GL_ONE,GL_ZERO) it would behave as if blending is disabled.

Ok, this is how I thought it would work.
Is there anything special in this regard when rendering to fbo-binded textures to other fbo’s?

glBlendFunc(GL_ONE,GL_ZERO);
fbo.bind(); glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
writeText(“text”);
fbo.unbind();

= clipped letters, (GL_ONE, GL_ONE) works correct…
I must be doing something really stupid :frowning: