代码都抄写好了,仔细核对都是正确的,只有背景color的颜色能改变,
就是画不出图像,也没有报错,参考一下修改:
环境:
Qt Creator 4.10.1
Based on Qt 5.13.1 (MSVC 2017, 32 bit)
Built on Oct 4 2019 01:16:32
From revision ea829fa6d5
Copyright 2008-2019 The Qt Company Ltd. All rights reserved.
The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
在pro文件里面
QT += opengl
LIBS += -lopengl32 -lglu32
在main函数里面,这个不一定要有
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);