transparent text in opengl

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
atcdevil
Posts: 30
Joined: Sun Mar 14, 2004 2:14 am

transparent text in opengl

Post by atcdevil »

Text doesn't render transparent for me using OpenGL + setOverrideColor + enableOverrideColor. If alpha is 0... the text is invisible, if it is anything greater it is opaque, nothing in between.

Is this a known issue?

EDIT:

I went into CVideoOpenGL.cpp in draw2DImage:
I changed the setRenderStates2DMode calls to:

Code: Select all

if (useAlphaChannelOfTexture) setRenderStates2DMode(color.getAlpha() < 255, true, true);
else setRenderStates2DMode(color.getAlpha() < 255, true, false);
Then in setRenderStates2DMode, in the case that texture and alphaChannel are true, I changed the body to:

Code: Select all

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
Enabling blending was originally commented out without an explanation, anyone know why that is?

EDIT: See below for update...
Last edited by atcdevil on Thu Jul 22, 2004 1:07 pm, edited 1 time in total.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

I think it is simply a bug, I did not implement the OpenGL-version very perfectly. Your code fixes all the problems?
atcdevil
Posts: 30
Joined: Sun Mar 14, 2004 2:14 am

Post by atcdevil »

It works in my simple test program. I haven't done any comprehensive testing. I can get back to you on that as I use it more.

I also tweaked that 2nd snippet a little bit to be:

Code: Select all

	
if(alpha) {
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
else {
	glDisable(GL_BLEND);
}
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0);
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

there are two sections that begin if(alpha). Whcih one are did you change?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Post Reply