Weird problem with my new particle engine class
Im just working on a new particle engine class (its not that great still) but the alpha channel seems to be broken when i specify my color. I do somthing like:
glColor4f(1,1,1,plife);
and plife is between 0 and 1. 0 being pretty close to it being deat and 1 being alive. but that doesnt have any effect on the color. its full on till it is deleted.
Any ideas? I can post the drawing code if you want.
That would be useful, yes.
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
-------- E y e .Scream Software --------
----------------------------------------
/-\
http://www.eyescream.cjb.net | * |
\-/
----------------------------------------
|
disable lighting + enable modulate
http://uk.geocities.com/sloppyturds/gotterdammerung.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
Translation :
glDisable(GL_LIGHTING);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_LIGHTING);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
Its still not working. I have removed the lighting code completely from the project. Used that modulate thing, disabled color material. Still acting funny. If you want to see any other code, particle creation etc just ask.
Thanks for the help
Thanks for the help
this is probably not very helpful, but be sure to check where exactly the problem is...
so, call
glColor4f(1.0f,1.0f,1.0f,0.2f);
and look if the particles are transparent then...
I am suspecting that your variabes "a->life" and "life" are integers... and therefore "a->life/life" is an integer division, which will result in an integer... (so, if you expect something between 0 and 1, it will always be rounded to 0!).
nik
Edited by - LeMatsch on February 15, 2002 11:13:31 AM
Edited by - LeMatsch on February 15, 2002 11:14:20 AM
so, call
glColor4f(1.0f,1.0f,1.0f,0.2f);
and look if the particles are transparent then...
I am suspecting that your variabes "a->life" and "life" are integers... and therefore "a->life/life" is an integer division, which will result in an integer... (so, if you expect something between 0 and 1, it will always be rounded to 0!).
nik
Edited by - LeMatsch on February 15, 2002 11:13:31 AM
Edited by - LeMatsch on February 15, 2002 11:14:20 AM
I hope that your particles are located "randomly".
If all your particles have the same coordinates, then this effect is normal.
Gotta check''em m8.
If all your particles have the same coordinates, then this effect is normal.
Gotta check''em m8.
you chould probably change
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
to
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
*and*
glColor4f(1,1,1,a->life/life);
to
glColor4f(1,1,1,((float)a->life/(float)life));
Hope that works.
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
to
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
*and*
glColor4f(1,1,1,a->life/life);
to
glColor4f(1,1,1,((float)a->life/(float)life));
Hope that works.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
Well I tried the 0.2 for alpha nad it doesnt seem to have any effect. Also, the blending function just makes the black part of the particle visible.
Im having a heck of a time testing the program now (my geforce 2''s fan just died so im using an old pci voodoo banshee) so its giving me 0.5fps and it aint pretty.
the generation code is:
yes the life variables are floats:
Thanx again
Im having a heck of a time testing the program now (my geforce 2''s fan just died so im using an old pci voodoo banshee) so its giving me 0.5fps and it aint pretty.
the generation code is:
|
yes the life variables are floats:
|
Thanx again
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement