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:
- OpenGL class library and environment configuration under win10 and vs2015
- The solution of OpenGL not displaying normally in win7 system
- Configuring glfw library and glad Library in opengl-vs2015
- Vs2015 configuring OpenGL development environment: configuration of glfw library and glad Library
- Configuring OpenGL development environment in win10 + vs2015 (including the method of installing 32-bit and 64 bit libraries)
- |-OpenGL – | some small problems about the glut Library
- Vs configuration of OpenGL development environment: configuration of glfw library and glad Library
- The solution of configuring OpenGL in vs2017
- QT running prompt failed to create OpenGL context for format qsurfaceformat (version 2.0, options qflags() solution)
- Configuring OpenGL with win 10 + CodeBlocks
- Summary of problems encountered in using OpenGL in QT
- Vs2015 configuring OpenGL (glfw Library)
- OpenGL, such as glad library and glfw library, is incompatible
- The experience of installing OpenGL in vs2017 under win7 system
- Solve the problem of VC6.0 open crash and OpenGL glut32.lib library
- QT encountered in CentOS installation( qt.qpa.plugin : Could not load the Qt platform plugin “xcb” )
- Solution of OpenGL window flicker in MFC framework
- Solution to the error of win7 & win10 shared printer 0x000000709
- Vtk8.2.0 (32bit + 64bit) compilation and installation test (win10 + vs2017 + Qt5)
- Configuration of OpenGL development environment under Windows environment, win10 + vs2019 + glfw + glad