OpenGL Road (5) create a rotating airplane model and an opengl airplane model

Source: Internet
Author: User

OpenGL Road (5) create a rotating airplane model and an opengl airplane model

# Include <gl/glut. h> # include <gl/GLU. h> # include <gl/GL. h> # pragma comment (lib, "opengl32.lib") # pragma comment (lib, "glu32.lib") # pragma comment (lib, "glu32.lib") # pragma comment (lib, "glut. lib ") # include <math. h> void Cube () // Cube {glBegin (GL_QUAD_STRIP); // fill the convex polygon glVertex3f (0.0f, 0.0f, 0.0f); glVertex3f (0.0f, 1.0f, 0.0f ); glVertex3f (1.0f, 0.0f, 0.0f); glVertex3f (1.0f, 1.0f, 0.0f); glVertex3f (1.0f, 0.0f,-1.0 F); glVertex3f (1.0f, 1.0f,-1.0f); glVertex3f (0.0f, 0.0f,-1.0f); then (0.0f, 1.0f,-1.0f); glVertex3f (0.0f, 0.0f, 0.0f); Round (0.0f, 1.0f, 0.0f); glEnd (); glBegin (gradient); glVertex3f (0.0f, 0.0f, 0.0f); glVertex3f (1.0f, 0.0f, 0.0f ); glVertex3f (0.0f, 0.0f,-1.0f); glVertex3f (1.0f, 0.0f,-1.0f); then (0.0f, 1.0f, 0.0f); glVertex3f (1.0f, 1.0f, 0.0f ); glVertex3f (0.0f, 1.0f,-1.0f); glVertex3f (1. 0f, 1.0f,-1.0f); glEnd ();} void Circle () // circular surface {glBegin (GL_TRIANGLE_FAN); // slice continuously filled triangle string glVertex3f (0.0f, 0.0f, 0.0f); int I = 0; for (I = 0; I <= 375; I + = 15) {float p = I * 3.14/180; glVertex3f (sin (p), cos (p), 0.0f);} glEnd ();} void Cylinder () // cylindrical {glBegin (GL_QUAD_STRIP ); // continuously fill the Quadrilateral string int I = 0; for (I = 0; I <= 375; I ++ = 15) {float p = I * 3.14/180; glVertex3f (sin (p), cos (p), 1.0f); glVertex3f (sin (p), cos (p ), 0.0f);} glEnd (); Circle (); glTranslatef (0, 0, 1); Circle ();} void Cone () // Cone {glBegin (GL_QUAD_STRIP ); // continuously fill the Quadrilateral string int I = 0; for (I = 0; I <= 390; I ++ = 15) {float p = I * 3.14/180; glVertex3f (0, 0, 1.0f); glVertex3f (sin (p), cos (p), 0.0f);} glEnd (); Circle ();} void AirPlane (float x, float y, float z) {static float I = 0, f = 0; I + = 0.1; f + = 0.01; if (I> 360) I = 0; if (f> 360) f = 0; glPushMatrix (); glTranslatef (x, Y, z); glRotatef (f, 1, 1, 1); glPushMatrix (); glColor3f (0.5, 1.5, 0.5); glRotatef (I, 0, 1, 0 ); glTranslatef (0, 0, 0.5); glScalef (0.1, 0.05, 1); Cube (); // propeller glPopMatrix (); glTranslatef (0,-0.1, 0 ); glScalef (0.1, 0.1, 0.1); Cube (); glScalef (10, 10, 10); glColor3f (1, 0, 1); glTranslatef (0.04,-0.05, -0.9); glScalef (0.1, 0.1, 1.5); Cylinder (); glColor3f (0, 1, 0); glScalef (1, 1, 0.2); Cone (); glColor3f (0, 1, 1); glTrans Latef (0, 0.7,-4.5); glScalef (0.2, 2, 1); Cube (); glTranslatef (-13, 0.3, 0); glScalef (27, 0.1, 1); Cube (); glPopMatrix ();} void renderScene (void) {glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); AirPlane (0, 0,-3 ); gluswapbuffers ();} void changeSize (int w, int h) {// prevent the divisor (that is, the height is 0) // (you can set the window width to 0 ). if (h = 0) h = 1; float ratio = 1.0 * w/h; // unitized projection matrix. GlMatrixMode (GL_PROJECTION); glLoadIdentity (); // you can specify the window size as glViewport (0, 0, w, h). // set the correct projection matrix gluPerspective (45, ratio, 1, 1000); // The following is the set model view matrix glMatrixMode (GL_MODELVIEW); glLoadIdentity (); gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0,-1.0, 0.0f, 1.0f, 0.0f); // set the observation point} int main (int argc, char * argv []) {gluinit (& argc, argv ); fig ); // call the function glureshapefunc (changeSize) when the specified program is idle; // specify the callback function glable (GL_DEPTH_TEST) when the window shape changes; glumainloop (); return 0 ;}

Preview



Aircraft Model Creation Method

The methods and tools used to create aircraft models are as follows: Hope you can use the following tools: ruler, knife, plane, saw, file, drill, pliers, scissors, wrench, pen, and soldering iron. All tools should be correctly used to play the role of the tool, so that the accuracy and accuracy of model creation are constantly improved, and model aircraft with excellent performance can be produced. The ruler must be straight. Do not reverse the wood grain cutting when the knife is sharp. The model is used as a specialized small planer to smooth the surface of a large model, which can improve work efficiency and accuracy. Because the materials used to create models are not very large and thick materials, we usually use a saw blade with relatively small teeth. You can choose the desired saw as needed, it is also often used for line saw. The application of the file, the rough file is used for the blank and the workpiece with a large amount of work to improve efficiency; the fine file is used for finishing to ensure the accuracy of the workpiece; the oily file is used for the fine Workpiece with a high surface smoothness. Among the models, the most commonly used tools are assorted files. The drill is used, especially when the remote control model is used to create a large number of Circular Holes. When the materials are not thick, you can use some materials to make small-angle drills and flat drills. For thicker materials, you can use electric drills and other tools, a small table-mounted drill can be used if conditions permit. The commonly used materials include Tung wood, pine, eucalyptus, birch, water pine, light wood, and laminate. When making a hand-throwing or ejection model, choose tongmu. For the material selection of the constructor wing, for example, the wing beam is slender and the main force component, we need to choose Pine with a high strength and straight texture. Wing ribs are mainly used to maintain the shape of the airlinder with little stress. They can be light weight or light wood with a certain strength. Wing root wing tip and other plastic filling parts, the smaller the force, the better, you can choose light Tung wood, light wood or water pine. Under the premise of ensuring the strength, materials with uniform materials, straight texture, no knots and light weight should be selected to ensure the strength and reduce the weight. Tongmu is the most commonly used model material, especially the eucalyptus, which features a light weight, high relative strength, small deformation, and easy to process. Wing ribs, masked panels, web and the rear section of the fuselage should be light materials. Materials with dense wood, straight texture, and high strength should be used for trailing edges, tail beam, and longitudinal beam of the fuselage. Pine northeast Pine with even texture, fine wood, light, not easy to deform, easy to process and flexible, is a good material for the slender force parts in the model. The birch material is hard, the texture is uniform and tight, and the proportion is large. It is a good material for propeller. It can also be used as an engine frame and other stress parts. Mongowood is a good material used to create a realistic model. It can also be used in hard shell fuselage, propeller and Engine Rack. Soft water, messy texture, and easy deformation are used for shaping and filling. The model of light wood production is better than that of tongmu, which can improve the flight performance, but the price is high. When using wood, consider the strength, rigidity and other characteristics. As early as 800 years ago in the Song Dynasty, the construction craftsman Li Jie set the cross section height and width ratio of building materials. At the end of the 19th century, a study by Tom yang found that the material section height and width are 3.46: 2, with the maximum rigidity and 2.8: 2 with the maximum strength; when the height and width are equal, the elasticity is maximum. Select appropriate materials based on the model size and structure during use. The anchor wood laminate is often used as the frame of the fuselage and the upper anti-angle reinforcing slice. The birch laminate can be used as the mask plate with high strength, and the rib, frame and reinforcing slice of the wing root. Bamboo is also commonly used in popular models. Traditional processes of skin use cotton paper and nylon silk, and then use non-woven fabrics and heat-scaling films of new materials. The model also uses tongmu skin as needed. Using the thermal scaling film can save a certain amount of money, but it mainly simplifies the production process and shortens the production time. Commonly used adhesives include white latex, resin, and 502. Kuaidi requires self-preparation. It has a wide range of use and is easy to bond. Its disadvantage is that it is toxic and should not be used for a long time. The price of white latex is low because the curing time is too long, which is not conducive to model finalization. Models and components that are easy to shape or can be shaped using the workbench are often glued with white latex. Because of stable performance, water resistance, oil resistance and corrosion resistance, resin glue is suitable for engine frame and other stress components. It must be strictly followed by the gluing instructions to ensure the bonding quality and can also be used for repair work. 502 suitable for connection and repair of small gaps. Do not stick it to your hands during use. Cut the excess part of the wood slice, or cut the required Wood Slice, front and back edges, web pages, and wing ribs from the slice. When cutting, pay attention to the direction of wood grain. The force should be light and then gradually applied to the force until the cutting is broken. It cannot be cut, especially when cutting the arc. Because now many materials are made for Planing ...... The Rest Of The full text>

How to create an airplane model? (Flying, running, making sound, shining, and iron) Please have a detailed process and materials! Thanks

1. Prepare tools. 2. Understand the internal structure of the model (similar to a real aircraft, but much simpler ). 3. Prepare and understand the materials (10-20% RMB ). 4. drawing. I used Autocad for design and output. 5. Production and debugging. 6. I have tried the remote control model to test your flight, because you may be excited to shake your hands that day. How to Create a remote control plane is divided into several parts: 1: Remote control part. 2. radio transmitting and receiving part. 3. Control Circuit. 4. aircraft mechanical part. I am not familiar with the last part, but I should have bought it. you can buy a model for that airplane and get it back for modification. remote control, if you do not have many functions, you can use the 2262 \ 2272 encoding/decoding chip. as for radio, it is very troublesome to sell the launch and receive modules that are well-prepared. Sometimes it is better to buy a ready-made product. after connecting the above things, you can output a signal from 2272. Use this signal to control stepper motors and so on. Of course, you need to connect a circuit yourself. self-designed, not difficult. mechanical Technology is actually very simple. First, materials must be selected. The requirement must be light and have a certain intensity. At present, nano materials are most used in small models, it looks a bit like foam, but the intensity is large. The second is machinery. For a simple model, you need two motors mounted on the airplane wing. The motor only needs to control the speed. When both motors rotate at high speed, the propeller is driven to lift the plane up. When the speed is low or stops, the plane drops. When the motor speed on both sides is not balanced, the aircraft is tilted towards the motor direction at a low speed, as long as the control circuit of the motor is ready OK. You can only tell you that the airplane model has rubber band power, internal combustion engine power, micro-turbine jet power, and electric power. an airplane model consists of the fuselage, wing, tail, receiver, steering gear, and wheels. this is the most basic. for example, an aircraft powered by an internal combustion engine has an internal combustion engine of 500 cc and $. the steering gear is used to control the navigation, that is, lift and fall, and the tail is in the direction. there is also a fuel tank, generally 600 ml of mixed oil (gasoline + alcohol + kerosene), tubing. receiver (more advanced, more complex), body, wing, remember that the body is 70%-80% length of the wing. if you are a beginner, I recommend that you use electric products that are both cheap and simple. i'm not talking too much about the limited time. I am also a beginner in airplane model! There are two planes. We plan to build an aircraft carrier this year. Haha! I really envy the creation of aerial models! This is not a matter of money. It does not cost much. 1. A large flow table and woodworking station. 2. A professional production platform (including drilling machines and small lathes ). 3. There are two toolboxes to work on. 4. If possible, create a small paint room. 5. If possible, build a small pool.
6. Electrician production platform and related tools. 7. Design and writing desk. 8. Comprehensive lighting. 9. Complete Set of testing equipment (multimeter, speedometer, etc ). 10. Various small parts (which depends on your usual collection ). General knowledge of the aviation model 1. What is the aviation model? In the competition rules formulated by the IOV, it is clearly stated that "the aviation model is air-heavy and has limited size, an aircraft with or without an engine that cannot be manned is called an aviation model. The technical requirements are as follows:
The maximum flight weight is 5 kg in the same fuel, the maximum lift area is one hundred and fifty square meters, and the maximum wing load is 100 grams/square meter. The maximum working volume of the piston engine is 10 litre. 1. What is an airplane model? Generally, a model that is made in proportion to the actual size of an airplane is called an airplane model. 2. What is a model aircraft? Generally, a model aircraft that can fly in the air is called an aviation model. 2. model aircraft components model aircraft are generally the same as manned aircraft, mainly composed of five parts: wing, tail, fuselage, landing gear and engine. 1. the wing is a device that generates lift when a model aircraft is flying, and can maintain horizontal stability when the model aircraft is flying. 2. Tail: includes the horizontal tail and the vertical tail. Horizontal Tail ...... remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.