Jump to content


new question!!!


17 replies to this topic

#1 ramzi085

    New Member

  • Members
  • PipPip
  • 12 posts

Posted 08 December 2005 - 05:22 PM

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

#2 roxtar

    Member

  • Members
  • PipPip
  • 94 posts

Posted 08 December 2005 - 05:32 PM

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.

#3 ramzi085

    New Member

  • Members
  • PipPip
  • 12 posts

Posted 08 December 2005 - 05:44 PM

thanx but i need more information

#4 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 08 December 2005 - 06:01 PM

The book "Physics for Game Developers" from O'Reilly has an example.
Didn't you just post this question a few days ago?
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#5 eddie

    Senior Member

  • Members
  • PipPipPipPip
  • 751 posts

Posted 08 December 2005 - 06:06 PM

This sounds sneakily like a homework project.

#6 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 08 December 2005 - 06:13 PM

You aren't the first to think this. He cross posted this question two weeks ago:
http://www.devmaster...read.php?t=4586
http://www.devmaster...read.php?t=4588
And bladder already gave him an answer.
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#7 ramzi085

    New Member

  • Members
  • PipPip
  • 12 posts

Posted 08 December 2005 - 07:46 PM

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

#8 Axel

    Valued Member

  • Members
  • PipPipPip
  • 119 posts

Posted 08 December 2005 - 08:56 PM

Don't feed the troll.

#9 eddie

    Senior Member

  • Members
  • PipPipPipPip
  • 751 posts

Posted 08 December 2005 - 11:49 PM

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.

#10 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 575 posts

Posted 09 December 2005 - 09:09 AM

This might help ...

http://www.gamasutra...liveira_pfv.htm

#11 anubis

    Senior Member

  • Members
  • PipPipPipPip
  • 2225 posts

Posted 09 December 2005 - 05:06 PM

http://nehe.gamedev....n.asp?lesson=11
If Prolog is the answer, what is the question ?

#12 ramzi085

    New Member

  • Members
  • PipPip
  • 12 posts

Posted 09 December 2005 - 07:53 PM

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

#13 eddie

    Senior Member

  • Members
  • PipPipPipPip
  • 751 posts

Posted 09 December 2005 - 08:16 PM

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.

#14 damn

    New Member

  • Members
  • PipPip
  • 22 posts

Posted 10 December 2005 - 12:40 PM

ramzi085 said:

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...

#15 kgkg

    New Member

  • Members
  • Pip
  • 8 posts

Posted 27 December 2005 - 07:04 PM

roxtar said:

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

#16 Reedbeta

    DevMaster Staff

  • Administrators
  • 5309 posts
  • LocationSanta Clara, CA

Posted 27 December 2005 - 10:35 PM

In this case, y_trans is the height of the flag.
reedbeta.com - developer blog, OpenGL demos, and other projects

#17 kgkg

    New Member

  • Members
  • Pip
  • 8 posts

Posted 28 December 2005 - 05:28 AM

Reedbeta said:

In this case, y_trans is the height of the flag.
ok..thnx a lot :yes:

#18 XORcist

    Member

  • Members
  • PipPip
  • 39 posts

Posted 03 January 2006 - 04:49 AM

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

good luck ramzie, kgkg, ... :yes:





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users