Problems with compiling OpenGL using Qt

Source: Internet
Author: User

Problems with compiling OpenGL using Qt

Software Version: Qt 4.8.5
According to the online routines (http://www.qiliang.net/old/nehe_qt/lesson01.html), ran Based on Qt Creator OpenGL. Because the Qt version of the above routine is older (the routine is for 02 years, Khan !), There are many problems in the new Qt environment. Fortunately, they have been solved one by one. The following is an illustration:
1. You need to add OpenGL support in the project file. pro:
QT + = opengl (remember to clear the project and compile it again !)
Otherwise, there will be a lot of problems like error: undefined reference to 'glshademodel @ 4', error: undefined reference to 'glclearcolor @ 16.

2. setCaption: [error: "setCaption 'was not declared in this scope]
In the new version, it is replaced by the setWindowTitle () function:
SetCaption ("Qt Open-GL"); --> setWindowTitle ("Qt Open-GL ");

3. For functions starting with glu, such as gluPerspective (): [error: 'gluperspective 'was not declared in this scope], the header file must be included.
# Include

 

 

4. If QKeyEvent is used, the header file [error: invalid use of incomplete type 'struct qkeyevent'] must be included.
# Include

 

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.