Programming phase 1) Create a project. In the Visual C build environment, use AppWizard to build an MFC-based single document application. 2) Add opengl32lib, glaux.lib, glu32.lib library. 3) Modify the header file of the View class. Add the following lines to the header file of the View class: includeglgl.hincludeglglu.hincludeglglaux.h4) Copy lathe.cpp and lathe.h to the project directory, then add the obtained axial.cpp and axial.h respectively. <4> in SourceFiles and HeaderFiles. Add includeathe.h to the Doc.cpp and View.cpp files. Add pixel format settings, create function model functions, set light functions, select material functions, render functions, etc. in the View.cpp file. The files in the same format imported into OpenGL are basically the same. The mouse message function is added through the VC Add Function Wizard to control the interactive animation. After adding various variables as needed in the View.h file, debug. During the debugging process, you will encounter the following error: unexpectedendoffoffwhilelookingforprecompiledheaderdirectiveErrorexecutingcl.exe. When you double-click the error, it will point to the end of the axial.cpp file. Add: includeddafx.h. The error will disappear when recompiled. After compiling, there is no display on the screen. The imported graphics are displayed in the crop area by changing the parameters and order of the two functions glSaclef and glTranslatef. The depth coordinates of OpenGL are directed to the inside of the display in the positive direction, and the other two directions are positive in the up and right directions. Knowing this will make it easy to find imported objects. In the modeling phase of software production, the 3DSMAX system axis coordinate origin coincides with the center of the object. When the model is displayed, a common problem is encountered, that is, the color set in 3DSMAX does not show the correct color after debugging. The name of the material given in the material editing dialog when found in 3DSMAX directly in axial.cpp. The material is represented by a one-dimensional array with four members and each member has six parameters. The data structure defined in axial.h is: typedefstruct{floatambient;floatdiffuse;floatspecular;floatemission;floatalpha;inttexture;}MaterialDef; modify the above parameters to get better rendering results. Attention to the key point coordinates unified software model used to establish the model and OpenGL coordinates unified, when displayed, there will be no phenomenon that the display object can not be found. The unit unit is unified with the OpenGL unit when the model is built, and the appropriate size model can be obtained in the window. The sequence of functions glTranslatef and glRotatef in the program will affect the control of the mouse. When the mouse controls the rotation of the object, sometimes the object suddenly disappears, that is, because there is no order in which the translation changes and the rotation change are not noticed during programming. Modifying the two functions of glTranslatef and glRotatef can achieve the purpose of the center of rotation and the center of the object. In the demonstration process of the teaching, each complex surface of the complex model is displayed on the screen, which improves the display ability of the teaching software to the designated part. Parameter setting dialog implementation 1) A dialog class inherited under the VC base class CDialog, used as the control panel for input parameters. 2) Add a message passing function to the menu. This message passing function should be in the View class. 3) Set the correct ID for the dialog and menu, and define this ID in the header file of the resource file. Connect the ID of the menu when the message is delivered. Conclusion There are many ways to convert 3DSMAX models into OpenGL. There are also a lot of intermediate conversion software. For example, 3DWin and 3DExploration are the two most used software. Can output 3DSMAX. The ase format, max format, and other software such as CAD output dwg format, dxf format, etc. more than ten formats into OpenGL format. Some companies and schools are now using VEGACREATOR in combination to develop interactive visual simulation systems. It is very convenient to use 3D software to build the required model and solve the complicated process of building a model in the program. Therefore, 3DSMAX can also be used to create relatively free stereos, such as characters, animals, etc., and then convert to OpenGL to create interactive animations, thus designing interactive animations and more complete auxiliary virtual manufacturing. Through the powerful 3D display effect of OpneGL, this paper realizes the 3D modeling of the machine tool and the 3D model rendering of the output virtual product. At present, only G code to virtual products is realized. The future research direction will gradually realize the communication interface design from computer and machine tool, complete the process from virtual code to real product, and add the precision of machine tool and tool wear to virtual manufacturing. The impact of accuracy. (Finish) Metal 3D Printer,Ceramic Sand Casting Molds,Advanced Metal 3D Printer,Compact Binder Jet 3D Printer Guangdong Fenghua Zhuoli Technology Co., Ltd , https://www.fhzl3d-print.com