Torpedo are basically self-propelled weapon cylindrical shaped (more like a cigar-shaped), which can be fired either underwater or above water fired from ship, submarine. It designed to detonate either on contact with its target or in proximity to it.
Today we are presenting the OpenGL Code Example for Torpedo. We are going to draw Torpedo in Visula Studio C++ using opengl graphics API. This program is an enhancement of torpedo with a texturing of the body and the blades. This Program is written by Sumanta Guha. We are presenting the same version of code with no modification.
Bezire curves is used for the blades. The Control points for a propeller blade Bezier surface and Control points for the texture co-ordinates Bezier surface is defined. These are used for giving a textures to the blades and the body.
Today we are presenting the OpenGL Code Example for Torpedo. We are going to draw Torpedo in Visula Studio C++ using opengl graphics API. This program is an enhancement of torpedo with a texturing of the body and the blades. This Program is written by Sumanta Guha. We are presenting the same version of code with no modification.
Understand the Problem
Every project we do, first we have to analyze the problem. So first we have know the structure of torpedo. After that we have do decide how the design can be drawn using the available objects in OpenGL API. We done with the design of Torpedo, we have give the motion with some keyword functions.Design the structure of torpedo
Our Torpedo will have the following parts -- A cylindrical body with hemi-spherical front face.
- 3 rotating blades attached to shaft at the back face.
- 3 curved fins attached in middle of body at equal distance.
Bezire curves is used for the blades. The Control points for a propeller blade Bezier surface and Control points for the texture co-ordinates Bezier surface is defined. These are used for giving a textures to the blades and the body.
Interaction in the Program
Without having the user interaction in a program, it make the whole experience a dull one. The OpenGL Code Example program for Torpedo have the keyword interactions.
- Press space to toggle between animation on and off.
- Press the x, X, to rotate the viewpoint in the x-direction both forward and backward.
- Press the y, Y, to rotate the viewpoint in the x-direction both forward and backward.
- Press the z, Z, to rotate the viewpoint in the x-direction both forward and backward.
This is done by adding animation function to the display and giving the key their role for motion. You can download the whole Torpedo OpenGL Program Code with the link given below.
Please send the source code for this project to geethapbdvt@gmail.com
ReplyDeleteSend me code
Delete