transparent text in opengl (+patch)

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
iona
Posts: 19
Joined: Mon May 29, 2006 6:29 pm

transparent text in opengl (+patch)

Post by iona »

Hi,

I had some problems with rendering transparent fonts with opengl driver in irrlicht 1.0:

Code: Select all

             font2->draw(L"test", 
             rect<s32>(0, 0, 200, 200),
             SColor(100, 255, 255, 255)); 
This piece of code renders nothing for alpha=0 and solid text for alpha>0, without smooth transition.

--- 'temporary' solution:

In COpenGLDriver.cpp, in COpenGLDriver::setRenderStates2DMode (~line 1650) comment block of four glTexEnvf and insert an additional one:

Code: Select all

			/*
			glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
			glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
			glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
			glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
			*/
			glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

I called this solution 'temporary' because i'm not sure if removing these lines won't cause problems in other cases of use draw2DImage().

---- THE Solution :)

Just ctrl+c ctrl+v draw2dImage, rename it to draw2DLetter and change the function call in draw method from CGuiFont.cpp (line 318).



That's all. I hope it will be helpful.
iona
Post Reply