View Full Version : Confused about blending !

04-09-2010, 08:23 AM
Hello all,

I'm working with OpenGL ES 1.1 so keep that in mind while reading :P

I'm trying to get a font to render to a specified color, and it actually works but not for transparency. What I mean is if I want the font to be red, it's working but red with alpha at 50% juste shows like red with 100% alpha.

Here is a code example, there I'm trying to get a grey tint with 50% alpha but only gets the grey tint with no alpha.

glColor4f(0.8f, 0.8f, 0.8f, 0.5f);

Since I'm in OpenGL ES 1.1 I can't change the blend equation. So its blending with the default SrcColor*SrcFactor + DstColor*DstFactor.

Also I only have these two state enable :


So no color array ( does that make all vertex take the glColor* color ???)

Well I think I understand blending but cant figure this out lol

Also my font texture is White or tint of grey where text is and black elsewhere. So basically using glBlendFunc(GL_ONE, GL_ZERO); Makes the text the color specified by glColor* and the rest is perfect black.

Well I would be thankful if anyone could help me with this !



04-09-2010, 11:15 AM
have you allocated bits for alpha in your pixel format descriptor?

04-09-2010, 11:19 AM
I'm currently reading the red book so I'm not familiar with all the terms. Do you mean the way I generate my font texture ?

If so here it is :

glGenTextures(1, &(aDataHolder.textureID));
glBindTexture(GL_TEXTURE_2D, aDataHolder.textureID);
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA,aDataHolder.textureSize, aDataHolder.textureSize, 0,GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, data);

Alfonse Reinheart
04-09-2010, 11:34 AM
He's talking about how you create your OpenGL context. Are you using self-written code to initialize OpenGL, or are you using a toolkit like FreeGLUT or SDL or something?

04-09-2010, 11:45 AM
I'm using an EGL implentation on top of OpenKODE window system.