2012-01-25 58 views
0

我想弄清楚如何让我的Qt程序编译和链接到OpenGL ES2功能。如何获得OpenGL ES2与Qt编译

我创建了一个简单的程序,它使用QGLWidget在我的Qt应用程序中使用旧的OpenGL 1.0管道绘制一些简单的三角形。我想使用先进的2.0功能,比如维也纳组织和着色器,所以我开始根本不够试图通过分配一些缓冲区的VBO:

int ids[2]; 
glGenBuffers(2, ids); 

不幸的是,我的项目无法找到glGenBuffers(),我得到的错误消息

GlWidget.cpp:103: error: 'glGenBuffers' was not declared in this scope 

qgl.h的开始了“#elif指令定义(QT_OPENGL_ES_2)”行了,所以我尝试设置,对于预处理器,但它仍然找不到glGenBuffers()。

我不确定接下来要尝试什么。请让我知道如何让我的Qt程序使用OpenGL ES2。

这里的输出我得到当我编译:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE=/C/Qt/2010.02.1/qt/bin/qmake.exe SUBPROJECTS= .build-conf 
make[1]: Entering directory `/c/dev/kitfox.com/biz/monsterRacing/proj/CharacterEditor' 
/C/Qt/2010.02.1/qt/bin/qmake.exe VPATH=. -o qttmp-Debug.mk nbproject/qt-Debug.pro 
mv -f qttmp-Debug.mk nbproject/qt-Debug.mk 
"/usr/bin/make" -f nbproject/qt-Debug.mk dist/Debug/MinGW-Windows/CharacterEditor.exe 
make[2]: Entering directory `/c/dev/kitfox.com/biz/monsterRacing/proj/CharacterEditor' 
g++.exe -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/2010.02.1/qt/include/QtCore' -I'c:/Qt/2010.02.1/qt/include/QtGui' -I'c:/Qt/2010.02.1/qt/include/QtOpenGL' -I'c:/Qt/2010.02.1/qt/include' -I'c:/Qt/2010.02.1/qt/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'c:/Qt/2010.02.1/qt/mkspecs/default' -o build/Debug/MinGW-Windows/main.o main.cpp 
g++.exe -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/2010.02.1/qt/include/QtCore' -I'c:/Qt/2010.02.1/qt/include/QtGui' -I'c:/Qt/2010.02.1/qt/include/QtOpenGL' -I'c:/Qt/2010.02.1/qt/include' -I'c:/Qt/2010.02.1/qt/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'c:/Qt/2010.02.1/qt/mkspecs/default' -o build/Debug/MinGW-Windows/MainForm.o MainForm.cpp 
MainForm.cpp: In member function 'void MainForm::openFile()': 
MainForm.cpp:78: warning: unused variable 'surfSet' 
g++.exe -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/2010.02.1/qt/include/QtCore' -I'c:/Qt/2010.02.1/qt/include/QtGui' -I'c:/Qt/2010.02.1/qt/include/QtOpenGL' -I'c:/Qt/2010.02.1/qt/include' -I'c:/Qt/2010.02.1/qt/include/ActiveQt' -I'.' -I'.' -I'nbproject' -I'.' -I'c:/Qt/2010.02.1/qt/mkspecs/default' -o build/Debug/MinGW-Windows/GlWidget.o GlWidget.cpp 
GlWidget.cpp: In member function 'void GlWidget::buildMesh()': 
GlWidget.cpp:103: error: 'glGenBuffers' was not declared in this scope 
make[2]: Leaving directory `/c/dev/kitfox.com/biz/monsterRacing/proj/CharacterEditor' 
make[2]: *** [build/Debug/MinGW-Windows/GlWidget.o] Error 1 
make[1]: *** [.build-conf] Error 2 
make: *** [.build-impl] Error 2 
make[1]: Leaving directory `/c/dev/kitfox.com/biz/monsterRacing/proj/CharacterEditor' 
+0

您正在使用哪种OpenGL ES 2.0实现? – genpfault

+0

你的平台是什么? OpenGL ES适用于嵌入式系统。 –

+0

我不确定。无论Qt在安装时出现什么问题。我在MinGW上使用Qt 4.6.2。很多时候,我按照此页面上的说明操作:http://netbeans.org/kb/docs/cnd/qt-applications.html – kitfox

回答