Description: I want to realize the 3d display of 2d images for the sake of image processing, so I have written this code and I hope to share it with interested readers. The image is obtained from the BMP image file, and the second is from the clipboard. This code calls the OpenGL library function in the MFC to realize the three-dimensional display of the two-dimensional image, the width of the image, the height of the image and the brightness of the pixel are respectively the x,z and y coordinates of the three-dimensional space. The program mainly has initialization, mapping, resource release, and operation parts, which are implemented in ogl_mfcview.cpp files. OpenGL library initialization in the file OnCreate, InitScene and DrawScene function implementation, main initialize OpenGL runtime environment variables, illumination of the 3-d objects, materials, etc., due to a lot of document introduces OpenGL library initialization, here I am not much said, interested readers can refer to the relevant documents. Call the global function GLDraw3DBMP to complete the drawing part in the DrawScene function.
When you compile the source code, you must link the opengl32.lib glu32. Lib to the project.
You can change the material through the dialog box. Press the arrow keys to rotate the x axis of the 3d image, and the right and left arrow keys can be used to rotate the z-axis around the z-axis.
File list (Check if you may need any files):