new question!!!

3b9ef93763cd4bc91d70bef0fd34d495
0
ramzi085 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

Please log in or register to post a reply.

F373d9db2d13fdef465493773a6affab
0
roxtar 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.

3b9ef93763cd4bc91d70bef0fd34d495
0
ramzi085 101 Dec 08, 2005 at 17:44

thanx but i need more information

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 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?

Cd577ee1cb56aa2ad5645b7daa0a2830
0
eddie 101 Dec 08, 2005 at 18:06

This sounds sneakily like a homework project.

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 102 Dec 08, 2005 at 18:13

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

http://www.devmaster.net/forums/showthread.php?t=4586

http://www.devmaster.net/forums/showthread.php?t=4588
And bladder already gave him an answer.

3b9ef93763cd4bc91d70bef0fd34d495
0
ramzi085 101 Dec 08, 2005 at 19:46

but i didnt get any reply that answer my question!!!

Da26e799270ce5e8b62659ed77b11cef
0
Axel 101 Dec 08, 2005 at 20:56

Don’t feed the troll.

Cd577ee1cb56aa2ad5645b7daa0a2830
0
eddie 101 Dec 08, 2005 at 23:49

ramzi085:

You didn’t ask a very good question.

roxtar gave you a fantastic answer, and yet all you ask is, “I need more information”. If you can’t at least tell us what you’re missing, how the hell can we help you?

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.

6673a7d3bfd3d1db5e05c5676cc040b6
0
Goz 101 Dec 09, 2005 at 09:09
3b9ef93763cd4bc91d70bef0fd34d495
0
ramzi085 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

Cd577ee1cb56aa2ad5645b7daa0a2830
0
eddie 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.

F1c9c75e541af39cb5e9680a39d5f220
0
damn 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…

568e440a7ea628b5606e3184be31ec77
0
kgkg 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???
thnx in advance

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Dec 27, 2005 at 22:35

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

568e440a7ea628b5606e3184be31ec77
0
kgkg 101 Dec 28, 2005 at 05:28

@Reedbeta

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

ok..thnx a lot :yes:

Ba3efeb9b32781fd70060e804beb0201
0
XORcist 101 Jan 03, 2006 at 04:49

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

good luck ramzie, kgkg, … :yes: