• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2378
  • Last Modified:

Homework* Creating an moving 2D airplane using OpenGL - C++ please help URGENT !

Using OpenGL environment you are asked to create an airplane and move it around the screen.

Step 1: Define the shape of a 2D aircraft. You can draw a simple aircraft model as any sort of polygon.

Step 2: Make sure you can draw the airplane by calling a drawing function
Void draw_airplane(int xpos, int ypos, angle, warpfactor)                  
This function will draw the airplane at a position P= (xpos, ypos). The angle and warfpfactor will be explained in Step3 and Step 5 respectively. Make sure that the airplane does not crash when the airplane is close the screen border.

 Step 3: The rotation angle is defined by the angle . The rotation angle initially starts with a value of 0, which should make the direction of the airplane to the right of the screen. Use left and right arrow keys on the keyboard to rotate the airplane into left and right directions respectively.

Step 4: Each time the main loop of the program is executed, the airplane will have a position P and a velocity V.  Velocity of an object is defined by its speed and direction. Each time through the loop, the new position is obtained by adding the velocity vector to the position vector to get a new position for the airplane.
When the airplane gets near the edge of the screen it is moved to the opposite edge of the screen so that it goes off one edge onto another.

Step 5 (Optional, 20 points bonus). Choose a new key to control the velocity. When the key is hit, add a unit vector to the current velocity vector (in the same direction) that is
 
Assume that the airplane has a flexible hull, and when then thrusters is turned on, the airplane compresses in the direction with the angle . Make a variable C that defines the degree of compression of the airplane and make C larger when thrusting is used. Let C slowly return to its default value (no compression) when thrusting is not being used. In the draw airplane function, C should be passed in as the warp factor, and it should cause a scaling of the ship in the direction it is facing when the thrust is applied.
0
CahitEy
Asked:
CahitEy
1 Solution
 
CahitEyAuthor Commented:
Is anybody writing a code for me?
0
 
ZoppoCommented:
Hi CahitEy,

no, sorry, no one will write the code for you.

It is agains EE rules to do your homework for you. You can always ask about specific problems when trying to solve it.  Asking for a
solution however is out of question.

http://www.experts-exchange.com/help.jsp?hi=21

You should ask EE to delete this question (via the link 'Request Attention' above), then try to solve your problem yourself and ask specific question if you get stuck with any particular problem.

ZOPPO
0
 
George TokasCommented:
Instructions:
1. Find a good set of wrapper classes for OpenGL. I can't help you here because I'm using DirectX
2. The wrapper set will have ( my set for DirectX has) a class for an object (3D or 2D) instance. Create the instance of the object...
3. Using the functions (in example SetPosition()) you can move the instance according to the input you are getting...

The comment from zoppo is right.
Make a search here for OpenGL wrappers...

George Tokas.
0
 
ahmets35Commented:
Using OpenGL environment you are asked to create an airplane and move it around the
screen.
Step 1: Define the shape of a 2D aircraft. You can draw a simple aircraft model as any sort
of polygon.
Step 2: Make sure you can draw the airplane by calling a drawing function
Void draw_airplane(int xpos, int ypos, angle, warpfactor)
This function will draw the airplane at a position P= (xpos, ypos). The angle and warpfactor
will be explained in Step3 and Step 5 respectively. Make sure that the airplane does not crash
when the airplane is close the screen border.
Step 3: The rotation angle is defined by the angle¿ . The rotation angle initially starts
with a value of 0, which should make the direction of the airplane to the right of the screen.
Use left and right arrow keys on the keyboard to rotate the airplane into left and right
directions respectively.
Step 4: Each time the main loop of the program is executed, the airplane will have a
position P and a velocity V. Velocity of an object is defined by its speed and direction. Each
time through the loop, the new position is obtained by adding the velocity vector to the
position vector to get a new position for the airplane.
When the airplane gets near the edge of the screen it is moved to the opposite edge of the
screen so that it goes off one edge onto another.
Step 5 (Optional, 20 points bonus). Choose a new key to control the velocity. When the
key is hit, add a unit vector to the current velocity vector (in the same direction) that is
Vnew ¿V ¿ (Cos¿, sin¿)
Assume that the airplane has a flexible hull, and when the thrusters is turned on, the
airplane compresses in the direction with the angle¿ . Make a variable C that defines the
degree of compression of the airplane and make C larger when thrusting is used. Let C slowly
return to its default value (no compression) when thrusting is not being used. In the draw
airplane function, C should be passed in as the warp factor, and it should cause a scaling
of the ship in the direction it is facing when the thrust is applied.
0
 
gf hgCommented:
not nice
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now