Particle "tail"

Particle "tail"

Post by Nicolás Brenner Léni » Sun, 27 Aug 2000 04:00:00



Hi, I have an OpengGL program that displays a particle making a circular
trayectory, I want to add to this particle a nice "tail", for this I
have implemented a bidimensional array[200][3], to store the previous
200 coordenates of the particle (x, y and z), I have also implemented a
system to determine the "head" and "tail" of this array, so that I can
draw the tail in the right way. I'm using the GL_STRIP_LINE primitive to
draw the tail but I have a problem. I want to draw the tail in a way
that blends with the background at the end. I've manages to do this but
it doesn't work how I want it to, the tail is drawn once entirely, and
then it's drawn again, but it's always drawn entirely every 200
positions that the particle has gone through, not every but not every
time the particle changes it's coordenates.
I know that maybe I didn't explained myself very good, maybe I lack the
language to do it right, because english's not my native language, but
if you catch a glimpse of what the problem I'm trying to describe is,
please reply to this message. If you like I could send you the source
code so that you can try the program, it is very little and simple, or I
could even post it.
        Well, thanks in advance for your time and help,
                    Nicols Brenner
 
 
 

Particle "tail"

Post by Josiah Manso » Mon, 28 Aug 2000 15:44:44


it seems that what you want is for the trail to fade into complete
transparancy. to do this, make the first vertex have an alpha of 1, then for
each following vertex, reduce the alpha by .5%. the last vertex should be
completely transparent.

--

================================
Joe's programming corner
www.geocities.com/knowyotoe/

================================


Quote:> Hi, I have an OpengGL program that displays a particle making a circular
> trayectory, I want to add to this particle a nice "tail", for this I
> have implemented a bidimensional array[200][3], to store the previous
> 200 coordenates of the particle (x, y and z), I have also implemented a
> system to determine the "head" and "tail" of this array, so that I can
> draw the tail in the right way. I'm using the GL_STRIP_LINE primitive to
> draw the tail but I have a problem. I want to draw the tail in a way
> that blends with the background at the end. I've manages to do this but
> it doesn't work how I want it to, the tail is drawn once entirely, and
> then it's drawn again, but it's always drawn entirely every 200
> positions that the particle has gone through, not every but not every
> time the particle changes it's coordenates.
> I know that maybe I didn't explained myself very good, maybe I lack the
> language to do it right, because english's not my native language, but
> if you catch a glimpse of what the problem I'm trying to describe is,
> please reply to this message. If you like I could send you the source
> code so that you can try the program, it is very little and simple, or I
> could even post it.
>         Well, thanks in advance for your time and help,
>                     Nicols Brenner


 
 
 

Particle "tail"

Post by vdspe » Mon, 28 Aug 2000 04:00:00


----- Original Message -----

Newsgroups: comp.graphics.api.opengl
Sent: Sunday, August 27, 2000 8:44 AM
Subject: Re: Particle "tail"

> it seems that what you want is for the trail to fade into complete
> transparancy. to do this, make the first vertex have an alpha of 1, then
for
> each following vertex, reduce the alpha by .5%. the last vertex should be
> completely transparent.

yes, and how would you implement this alpha blending in opengl?

my suggestion: read out the value of the background
at the location of the vertex you want to draw,
then take this color with the tail's color like this:

    Ncolor = ( (i/n) * Bcolor + ( ( 1-(i/n) ) * Tcolor) )

where Ncolor is the color to draw with
Bcolor is the color of the background to draw onto at the location if the
i'th vertex
Tcolor is the color of the tail
n is the total number of vertices of the tail
i runs from 0 to n

 
 
 

Particle "tail"

Post by Rob » Mon, 28 Aug 2000 04:00:00



Quote:

> yes, and how would you implement this alpha blending in opengl?

What come's to mind right off the bat is...
glColor4f(red,green,blue,alpha);
Otherwhise it's a good question!
 
 
 

Particle "tail"

Post by vdspe » Tue, 29 Aug 2000 04:00:00


this is only functional for 'clipping' certain values if GL_ALPHA_TEST
is enabled by comparison through glAlphaFunc. so its a discrete 'cull' test
rather than a blending operation : (





> > yes, and how would you implement this alpha blending in opengl?

> What come's to mind right off the bat is...
> glColor4f(red,green,blue,alpha);
> Otherwhise it's a good question!

 
 
 

Particle "tail"

Post by Rob » Tue, 29 Aug 2000 04:00:00


Thank you!  I knew there was more to it but I haven't actually done it, just
read the docs that discussed glColor4f and didn't really look into the
enable's neccisary for it to work as I'm just starting to learn the alpha
stuff in gl.


> glColor4f is the answer, just not all of it.  You need to enable blending:

> glEnable(GL_BLEND);
> glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
> glBegin(...)
> glColor4f(r, g, b, a);
> <geometry>
> glEnd();
> glDisable(GL_BLEND);

> Stoned koala bears drooled eucalyptus spit in awe as vdspek declaimed:

> >this is only functional for 'clipping' certain values if GL_ALPHA_TEST
> >is enabled by comparison through glAlphaFunc. so its a discrete 'cull'
test
> >rather than a blending operation : (





> >> > yes, and how would you implement this alpha blending in opengl?

> >> What come's to mind right off the bat is...
> >> glColor4f(red,green,blue,alpha);
> >> Otherwhise it's a good question!

> William Brodie-Tyrrell

> ========================================================================
> A child of five could understand this.  Fetch me a child of five.
> -- Groucho Marx
> ========================================================================
> http://www.smug.adelaide.edu.au/~wfbrodie/


> ========================================================================

 
 
 

Particle "tail"

Post by William Brodie-Tyrrel » Wed, 30 Aug 2000 09:51:39


glColor4f is the answer, just not all of it.  You need to enable blending:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(...)
glColor4f(r, g, b, a);
<geometry>
glEnd();
glDisable(GL_BLEND);

Stoned koala bears drooled eucalyptus spit in awe as vdspek declaimed:

>this is only functional for 'clipping' certain values if GL_ALPHA_TEST
>is enabled by comparison through glAlphaFunc. so its a discrete 'cull' test
>rather than a blending operation : (





>> > yes, and how would you implement this alpha blending in opengl?

>> What come's to mind right off the bat is...
>> glColor4f(red,green,blue,alpha);
>> Otherwhise it's a good question!

William Brodie-Tyrrell

========================================================================
A child of five could understand this.  Fetch me a child of five.
                -- Groucho Marx
========================================================================
http://www.smug.adelaide.edu.au/~wfbrodie/


========================================================================

 
 
 

1. Drawing particle "tail" help please

Hi, I have an OpengGL program that displays a particle making a circular

trayectory, I want to add to this particle a nice "tail", for this I
have implemented a bidimensional array[200][3], to store the previous
200 coordenates of the particle (x, y and z), I have also implemented a
system to determine the "head" and "tail" of this array, so that I can
draw the tail in the right way. I'm using the GL_LINE_STRIP primitive to

draw the tail but I have a problem. I want to draw the tail in a way
that blends with the background at the end. I've manages to do this but
it doesn't work how I want it to, the tail is drawn once entirely, and
then it's drawn again, but it's always drawn entirely every 200
positions that the particle has gone through, not every but not every
time the particle changes it's coordenates.
I know that maybe I didn't explained myself very good, maybe I lack the
language to do it right, because english's not my native language, but
if you catch a glimpse of what the problem I'm trying to describe is,
please reply to this message. If you like I could send you the source
code so that you can try the program, it is very little and simple, or I

could even post it.
        Well, thanks in advance for your time and help,
                    Nicols Brenner

2. HEEEEEEEEEEELP!!!!!!!!!!

3. Plotting "tail" of data file

4. can′t get the green border when I want to activate the layer mask

5. ****"""""BUG IN PROGRAM"""*****

6. Particle Storm - constraining particles

7. """"LOOKING FOR METRAEYES MODELLER AND TURBO.PXP FOR AN EXCHANGE"""""

8. freeware "particle system"

9. "animated" instanced objects as particles

10. Making particles "glow"??

11. freeware "particle system"

12. Particles in a "Snow Globe"