How to get Qt Creator to build OpenGL (ES) 2.x programs?



  • Hi. With the upcoming N9 release I'm getting into OpenGL again. I wrote a few test projects in Qt (linux/desktop target) and am unable to compile them due to missing opengl 2.x (headers?). My project is inheriting from QGLWidget as per (the few available) examples. OpenGL 1.x works fine, but obviously I need 2.x so I can compile for a device with OpenGL 2.0 ES.

    What should I install in order to get Qt to compile for OGL 2.x? My environment is x64 Ubuntu 11.04, qtcreator 2.1.0-0ubuntu2, installed from standard apt repository.

    Do I need a newer (2.3.x?) Qt Creator and/or reconfigure/recompile the whole Qt or something..?

    Exact error being:

    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I../../trunk -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../../trunk -I../include -I/usr/X11R6/include -I. -I. -I. -o GLWidget.o ../src/GLWidget.cpp
    ../src/GLWidget.cpp: In member function ‘void GLWidget::DrawCube()’:
    ../src/GLWidget.cpp:158:48: error: ‘glVertexAttribPointer’ was not declared in this scope
    ../src/GLWidget.cpp:159:32: error: ‘glEnableVertexAttribArray’ was not declared in this scope
    make: *** [GLWidget.o] Error 1

    ty in advance,

    • matti


  • So I got as far as to use GLew to get it going on the desktop. When building for Harmattan (/other opengl es 2.0 device), I assume all the proper headers/libs will be there and I'll just need to #ifdef out the GLew stuff from code and .pro (-lGLEW)?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.