The solution of using OpenGL’s Glu Library in qt5.2 under win7

 

I recently used QT5.2 to learn OpenGL in Windows 7. I recently used QT5.2 to learn OpenGL in Windows 7. I recently used QT5.2 to learn OpenGL.

‘GluPerspective’ was not declared in this scope. The version of Qt used in this article is
Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB)
(Info), you can see the Qt version download information under various platforms from the Qt official website http://qt-project.org/downloads.

I searched the web for the following related solutions, which are for lower versions of Qt, such as this article: The GLU header file is not available for common Qt errors. I gave it a try and finally solved the problem with QT5.2 under Windows 7.
1. Add a header file to the source file of the glu library that references functions like gluPerspective: #include< gl/glu.h>
This step is necessary. For some reason, Glu32 libraries that start with glu and use OpenGL under QT5.2 also need to include GL /glu.h headers, while OpenGL32 libraries that start with GLL in OpenGL do not need to include headers.
Download Glut. lib and Glut32. lib and copy them to your Qt installation directory in Qt5.2.0\5.2.0\mingw48_32\lib, so that the Qt compiler will automatically search for the corresponding library files in the Qt installation directory.
This step may not be necessary.
Finally, I have tried the OpenGL under Qt (2) in my Qt5.2 environment (2) and the OpenGL example in C++ GUI Programming with Qt4(2nd Edition) Chapter 20. Make sure that after the above configuration, GluPerspective (45.0,(GLFloat)width/(GLFloat)height,0.1,100.0); And gluPickMatrix (GLdouble (pos) (x)), GLdouble (viewport [3] – pos. Y ()), 5.0, 5.0, viewport); These two lines of code work.

Reproduced in: https://www.cnblogs.com/lvdongjie/p/4775473.html

Read More: