rain loop

M

Mike

Hi
for a rainsimulation i do new drops(class) and set x/y. finally at the
end of loop I do delete the pointers.
Now:
- how could i increase the life span of the drops? Actually they are
drawn and immediately (loop end?) gone.
- how to add a trail? i load another image slightly below in y but to
make it longer(repeate) with wind.
I don't understand how to shape the loop.
Many thanks
Michael
 
M

Mike

the loop is alike:
for(int i=0;i<num;i++)
{
drops = new droplet
.........
if(drops->
...........
// then i tried a fadout before draw but that's not working as
always new drops at different x/y are created
FadeOUT();
}
//after we are done, clean the mess
for(drawed=0;drawed<num;drawed++) delete drops

How should i take it out the loop? I want to show the drops ~2 second
and fade away
Thanks
 
M

Mike

ok now i try without pointers but get:

cannot convert ‘GLfloat*’ to ‘GLfloat’ for argument ‘1’ to ‘void
glVertex2f(GLfloat, GLfloat)’

thanks
 
N

Nick Keighley

for a rainsimulation i do new drops(class) and set x/y. finally at the
end of loop I do delete the pointers.

which doesn't need dynamic allocation...
Now:
- how could i increase the life span of the drops?

don't call delete. I'm serious if calling delete at the end of the
loop is giving you raindrops the wrong lifetime then move the deletion
point.
Actually they are
drawn and immediately (loop end?) gone.
- how to add a trail? i load another image slightly below in y but to
make it longer(repeate) with wind.
I don't understand how to shape the loop.

we don't know enough about your application/OS/graphics lib. But
something like this:

void timerEvent(Time time)
{
if (time_to_create_a drop (time))
add_to_drop_collection (drop_collection, new_drop());

if (time_to_remove_drops (time))
remove_old_drops (drop_collection);

if (time_to_draw (time))
draw_stuff (drop_collection);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top