(C++)chatQue class [v0.2.3] Alpha Fade works w/ 1.2

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

I've only compiled the code under dev c++, as you could imagine it's not as picky as the (microsoft?) compiler you are using. I will update the code in the next few days when I have a moment to get ride of those pesky warnings for you ;)
DavidR
Posts: 34
Joined: Sat Jul 15, 2006 5:12 pm

Post by DavidR »

Halan, I have the same warnings as you under VS 2005.

Just declare this after the #define at the top of the header:

Code: Select all

#pragma warning( disable : 4996  4244  4156 4154)
It fixes the annoying warnings very nicely :)
Halan
Posts: 447
Joined: Tue Oct 04, 2005 8:17 pm
Location: Germany, Freak City
Contact:

Post by Halan »

oh i dont really care about the warnings i just wanted to inform you cause i didnt know if they could maybe cause some problems...
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

Hey Halen, I *think* I fixed warnings you pointed out. (I don't have irrlicht set up in visual studios at the moment) Could you double check the code in visual studio and confirm they are gone?

Thanks.

*Edit, the current version is in this post only, I havent uploaded it to the direct download location yet.
stodge
Posts: 216
Joined: Fri Dec 05, 2003 5:57 pm

Post by stodge »

No, no, no! Don't just ignore the warnings - fix them! One of them is a potential loss during a conversion. This should be fixed. The other seems to be implying you're mis-using delete.

Ignoring warnings is bad! :!:
What does the debugger tell you? You did use the debugger, didn't you?
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

stodge- the warnings have been fixed in the code posted on the first page of this thread, and they had no affect on the running of the program. They were only a little inefficient.

Oh and if you were replying to ether halan or DavidR, don't mind me!
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

I uploaded the changes to the download version. So feel free to get the changes via direct download.
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Re: (C++) chatQue class [v0.2.3] *Visual Studio Warnings Fix

Post by ssexton »

Rambus wrote: -Somehow implement alpha fade rather then fade to black
(If you make any of these changes, please post the code befor I do it myself!)
Here's the code for an alpha fade. In the existing code, you have this:

Code: Select all

//Fade code
f32 l_alpha = (   (f32)(l_time - iter->fade)/(f32)chatQue_fadeTime );
iter->color1 = iter->color1Fade.getInterpolated(SColor(0,0,0,0),1-l_alpha);
iter->color2 = iter->color2Fade.getInterpolated(SColor(0,0,0,0),1-l_alpha);
Change it to this:

Code: Select all

//Fade code
f32 l_alpha = (   (f32)(l_time - iter->fade)/(f32)chatQue_fadeTime );
iter->color1.setAlpha(iter->color1Fade.getAlpha() * (1-l_alpha));
iter->color2.setAlpha(iter->color2Fade.getAlpha() * (1-l_alpha));
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post by ssexton »

Oh yeah, a couple more things.

1. gcc complains about the switch statements that don't have a default: case. Its just a warning, but it gets in the way if you use -Werror (warnings as errors).

2. I can confirm that the code works fine on Mac OS X too. Give me a month or so and I'll be able to check Linux as well. Not that I expect any problems.
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

@ssexton
-Fade code,
What version of irrlicht are you using, that makes that fade code work? My problem is that regardless of what alpha value I give the text, it won't become transparent.

-I didn't know about the default warning in gcc, thanks for the heads up. I will fix it right now.

-Thanks for testing it on other OS's, If you find any problems with it running under linux be sure to let me know.
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post by ssexton »

Hm. Come to think of it, I didn't look too closely to see if the alpha fade was actually fading. I was just happy to get rid of the black. My bad.

Still, I'm 99% sure that the setAlpha() is the code you want to do a fade effect. That's what alpha *is*, and it's how I've done it before in "pure" OpenGL apps. So if its not actually fading out, my guess is that alpha blending is disabled in the video driver when you're drawing the font textures. I don't know Irrlicht well enough yet to know where to start looking for that. But I'd almost bet money that's what the issue is.
Veylon
Posts: 7
Joined: Wed Nov 15, 2006 7:21 pm

Post by Veylon »

Very nice looking!

I'll have to glom it on to my networking thingie and then I'll be able to chat with myself in style!
ssexton
Posts: 54
Joined: Wed Oct 25, 2006 7:46 am
Location: South Florida
Contact:

Post by ssexton »

@Rambus: Quick followup...

1) The fade code did work for me, as of svn 272, on Win with DX9.
2) It didn't work on Mac or Linux with OpenGL driver.
3) Yes, it works on Linux too.
Rambus
Posts: 96
Joined: Thu Nov 24, 2005 4:56 pm
Location: Canada
Contact:

Post by Rambus »

Ah, well I'm using irrlicht 1.1 release, so I imagine the dx fading is fixed in the svn version. For the time being I will leave your alternative code commented out, and the fade to black in. Thanks for checking that for me ssexton!

Edit: actually I can't recall if I tested the fade code for dx9 and irr 1.1, I will give that a check on the weekend. If that works I will probably make the dx driver fade alpha, and the opengl fall back of fading to black.

Double Edit: No, both dx and openGL of the current irrlicht release fail to alter the alpha. I guess I will have to wait for the next release.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

This looks useful. Have you asked hybrid or bitplane if it's a possible candidate for integration into the core?
Post Reply