【发布时间】:2015-01-03 01:05:15
【问题描述】:
我想实现一个可以使用 Assimp(link of Assimp) 将 3D 模型加载到 OpenGL 中的程序。
我的 Qt 版本是 5.3.2。
我使用Qt Creator并修改.pro文件来导入Assimp库:
INCLUDEPATH += H:\Study\assimp-3.1.1-win-binaries\assimp-3.1.1-win-binaries\include\assimp
LIBS += -lH:\Study\assimp-3.1.1-win-binaries\assimp-3.1.1-win-binaries\lib32\assimp
然后我尝试在我的程序中读取box.obj:
#include <scene.h>
#include <postprocess.h>
#include <Importer.hpp>
int main(){
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile("box.obj", NULL);
if (!scene)
{
qDebug() << "Error loading file: (assimp:) " << importer.GetErrorString();
return false;
}
.....// Other code to create a window
return 0;
}
然后编译完成,没有错误。 然后程序刚启动就崩溃了。
正在启动 G:\QtProject\QtTest\build-MyOpenGL-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Debug\debug\MyOpenGL.exe...
G:\QtProject\QtTest\build-MyOpenGL-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Debug\debug\MyOpenGL.exe 崩溃
我尝试调试,但断点似乎不起作用。
我删除了一些代码,只声明scene:
#include <scene.h>
#include <postprocess.h>
#include <Importer.hpp>
int main(){
//Assimp::Importer importer;
const aiScene* scene; // = importer.ReadFile("box.obj", NULL);
/*if (!scene)
{
qDebug() << "Error loading file: (assimp:) " << importer.GetErrorString();
return false;
}*/
.....// Other code to create a window
return 0;
}
程序可以再次运行!
我现在真的很困惑。谁能帮帮我?
【问题讨论】:
-
我的编译器是 Microsoft Visual C++ Compiler 10.0
标签: c++ qt qt-creator assimp