alpha textures and particles

Started by
7 comments, last by Spencer 20 years ago
Hi! I have som trouble with a particle system i am making. I am using a 1 byte alpha texture, shaped as a "sphere" opaque in the middle and more transparent to the sides...you know the drill Anyways....when i use it, i thought it would just be to bind this texture and then render my particles as two triangles with som color (glColor3f()) at each vertex and the texture would do the blending..but oh no..... so....how the heck do i do it? I mean...how do i tell opengl to use the alpha values from my texture when i render the particle.... thanks in advance
--Spencer"All in accordance with the prophecy..."
Advertisement
Look into blending. You have to enable it and set different values of opacity with a call to glColor4f().
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
yes...but i want the texture to be the alpha values...??

--Spencer

"All in accordance with the profecy..."
--Spencer"All in accordance with the prophecy..."
By default, the final colour of a pixel is the texture colour multiplied by the interpolated vertex colour. Alpha is included in the equation.
-Ostsol
yeah...okay...that seems to be working....but now i have another problem...
the particles blend nicely with the background, but not with each other....
i can see the square shapes every time a particle is on top another...
suggestion?

thanks a bunch

--Spencer

"All in accordance with the profecy..."
--Spencer"All in accordance with the prophecy..."
aight....solved it...
glDepthMask(false);

now i just have to figure out what it does

thanks all!


--Spencer

"All in accordance with the profecy..."
--Spencer"All in accordance with the prophecy..."
That turns off writes to the depth buffer, which certainly works for this.
-Ostsol
I believe you have to turn off depth-testing when drawing the particles...

glDepthTest(false);
//draw particles
glDepthTest(true);

EDIT: uhm. typos

-Trond

[edited by - Trond A on April 22, 2004 4:41:31 AM]

[edited by - Trond A on April 22, 2004 4:42:09 AM]
-Trond
Ah. glDepthMask it was then.

-Trond
-Trond

This topic is closed to new replies.

Advertisement