0
101 Dec 08, 2005 at 17:22

Hi everybody,
plz i want a openGL code to make a flag seems fly(flap)
plz its very important…

#### 17 Replies

0
101 Dec 08, 2005 at 17:32

You could take the flag to be two parallel sine waves which shift their phase a little bit in each frame.

for(phase=0;phase<360;phase++) {
for(theta=0;theta<360;theta++) {
x=(theta+phase)*PI/180;
y1=sin(x);
y2=sin(x)+y_trans;
plot pixel at x,y1 and x,y2
}
clear screen
}


This may not be too exact but I hope you got the idea. There surely must be better ways to do this also.

0
101 Dec 08, 2005 at 17:44

0
102 Dec 08, 2005 at 18:01

The book “Physics for Game Developers” from O’Reilly has an example.
Didn’t you just post this question a few days ago?

0
101 Dec 08, 2005 at 18:06

This sounds sneakily like a homework project.

0
102 Dec 08, 2005 at 18:13

You aren’t the first to think this. He cross posted this question two weeks ago:

0
101 Dec 08, 2005 at 19:46

0
101 Dec 08, 2005 at 20:56

Don’t feed the troll.

0
101 Dec 08, 2005 at 23:49

ramzi085:

You didn’t ask a very good question.

If you’re looking for the entire thing written out for you, you’re going to find it a hard time to get what you’re looking for: very few people are going to spoon feed you this.

0
101 Dec 09, 2005 at 09:09

This might help …

0
101 Dec 09, 2005 at 17:06
0
101 Dec 09, 2005 at 19:53

eddie i do my best in this project but i dont know how can make the flag seems fly thats all and i need simple code for that in 2d and i will do like it thats all
thanx anyway

0
101 Dec 09, 2005 at 20:16

That’s fine ramzi, but you should really learn to ask good questions. Large vague questions are hard to answer, and often frustrate the people on this forum.

If you could limit it a specific area you’re having issue with, even if it’s, “I have to do x, y, and z, and I’m not sure where to start. Should I do x first? Or y? Or z?”. Better yet, if you can experiment some and say, “I’ve tried x,y,z and I’ve got it mostly, but I’m really stuck with y. How do I do step 3 in y?”.

Those will yield you the best results.

0
101 Dec 10, 2005 at 12:40

@ramzi085

Hi everybody,
plz i want a openGL code to make a flag seems fly(flap)
plz its very important…

Hey… Go to nehe.gamedev.net There is a waving flag tutorial there…

0
101 Dec 27, 2005 at 19:04

@roxtar

You could take the flag to be two parallel sine waves which shift their phase a little bit in each frame.

for(phase=0;phase<360;phase++) {
for(theta=0;theta<360;theta++) {
x=(theta+phase)*PI/180;
y1=sin(x);
y2=sin(x)+y_trans;
plot pixel at x,y1 and x,y2
}
clear screen
}


This may not be too exact but I hope you got the idea. There surely must be better ways to do this also.

wht does y_trans refer to???

0
167 Dec 27, 2005 at 22:35

In this case, y_trans is the height of the flag.

0
101 Dec 28, 2005 at 05:28

@Reedbeta

In this case, y_trans is the height of the flag.

ok..thnx a lot :yes:

0
101 Jan 03, 2006 at 04:49

I hope, we are finally done with waving flag thing. :sneaky:

good luck ramzie, kgkg, … :yes: