QOpenGLWidget
我在一个QMainWindow
实例中嵌入了一个w
。编译没问题。但是在调试时,程序在w.show()
.
错误对话框说:
在 TestQtOpenGL.exe 中的 0x000007FEE5AF4469 (d3d11sdklayers.dll) 处引发异常:0xC0000005:访问冲突读取位置 0x00000806E5B03A98。
调用栈是:
d3d11sdklayers.dll!000007fee5af4469() Unknown
d3d11sdklayers.dll!000007fee5ad2971() Unknown
libGLESv2d.dll!000007fed7d58a8d() Unknown
libGLESv2d.dll!000007fed7d56313() Unknown
libGLESv2d.dll!000007fed7d55521() Unknown
libGLESv2d.dll!000007fed7b2308a() Unknown
libGLESv2d.dll!000007fed7b24f1b() Unknown
libGLESv2d.dll!000007fed79dbba8() Unknown
libGLESv2d.dll!000007fed7bf2678() Unknown
libEGLd.dll!000007feecd1209d() Unknown
qwindowsd.dll!000007fed86752ac() Unknown
qwindowsd.dll!000007fed8674906() Unknown
qwindowsd.dll!000007fed8602d55() Unknown
qwindowsd.dll!000007fed8602999() Unknown
qwindowsd.dll!000007fed860223b() Unknown
qwindowsd.dll!000007fed86020fe() Unknown
Qt5Guid.dll!000007fed93a18a0() Unknown
Qt5Widgetsd.dll!0000000057d55dc2() Unknown
Qt5Widgetsd.dll!0000000057d97037() Unknown
Qt5Widgetsd.dll!0000000057d95d45() Unknown
Qt5Widgetsd.dll!0000000057d439f6() Unknown
Qt5Widgetsd.dll!0000000057d95fa9() Unknown
Qt5Widgetsd.dll!0000000057ce700e() Unknown
Qt5Widgetsd.dll!0000000057ce46c6() Unknown
Qt5Cored.dll!0000000058c15af6() Unknown
Qt5Cored.dll!0000000058c20c32() Unknown
Qt5Widgetsd.dll!0000000057d520b0() Unknown
Qt5Widgetsd.dll!0000000057d523f0() Unknown
Qt5Widgetsd.dll!0000000057d3dd71() Unknown
Qt5Widgetsd.dll!0000000057d3e0c9() Unknown
Qt5Widgetsd.dll!0000000057d50b12() Unknown
Qt5Widgetsd.dll!0000000057d52411() Unknown
Qt5Widgetsd.dll!0000000057d3dd71() Unknown
Qt5Widgetsd.dll!0000000057d3e0c9() Unknown
> TestQtOpenGL.exe!main(int argc, char * * argv) Line 9 C++ TestQtOpenGL.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 104 C++
[External Code]
一个演示:
// main.cpp
#include "TestQtOpenGL.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
/*
* According to some solutions, I have tried the following
* codes, but no use.
*/
// QSurfaceFormat format; format.setDepthBufferSize(24);
// format.setStencilBufferSize(8);
// format.setVersion(4, 3);
// format.setProfile(QSurfaceFormat::CoreProfile);
// QSurfaceFormat::setDefaultFormat(format);
QApplication a(argc, argv);
TestQtOpenGL w;
w.show();
return a.exec();
}
// TestQtOpenGL.h
#pragma once
#include <QtWidgets/QMainWindow>
#include <qopenglwidget.h>
class TestQtOpenGL : public QMainWindow
{
Q_OBJECT
public:
TestQtOpenGL(QWidget *parent = Q_NULLPTR);
private:
QOpenGLWidget *glwidget;
};
// TestQtOpenGL.cpp
#include "TestQtOpenGL.h"
TestQtOpenGL::TestQtOpenGL(QWidget *parent)
: QMainWindow(parent)
{
setFixedSize(800, 600);
glwidget = new QOpenGLWidget(this);
setCentralWidget(glwidget);
}
环境:
- Qt 5.9.4 msvc2015 64bit
- 视觉工作室 2015
- Windows 7的
根据@Aleph0 的建议,我已经使用 [Visual Studio]->[Debug]->[Windows]->[Modules] 调查了加载的模块。但我没有发现任何可疑的 DLL。模块列表在此处上传。