Old OpenGL Version [Qt5, QtCreator, MacOs, GLEW]
-
Hello All,
I'have migrated my project to mac os. I'm using QtCreator to develop my project and finally I have everything working. I'm using Qt5.2 under QtCreator and i use glew which I have compiled with xcode. Everything seems to be working well, but when i do:
@GLenum err = glewInit ();
if (GLEW_OK != err)
{
std::cout << "<GLEW Init>: ERROR" << std::endl;
exit(1);
}
const unsigned char* version = glGetString(GL_VERSION);
std::cout << "OpenGL " << version << " initialized." << std::endl;@I obtain in the application console:
OpenGL 2.1 NVIDIA-8.24.9 310.40.25f01 initialized.
It is a bit strange version 2.1 :S ?! I supposed to have initialized version 4.x because I am using a new mac book pro with a nvidia 750... Why it is not using a newer version of OpenGL??????? Maybe it is not using the glew???
My .pro files have a general .pri which is:
@#################################### CONFIG ############################################
#Añadimos las configuraciones que utilizaran la mayor parte de librerias
#Ver : (http://doc.qt.nokia.com/latest/qmake-project-files.html)#Mostrar todos los warnings
CONFIG += warn_on#Permite compilar el proyecto en modo debug y release
CONFIG += debug_and_release#La aplicacion necesita una consola
CONFIG += console#La aplicacion usara Qt
CONFIG += qt#Muestra en VS los archivos con su estructura jerarquica de carpetas
CONFIG -= flat#Hay que definir que extensiones de qt no por defecto vendran
QT += opengl################################## DIRECTORIOS #########################################
#Directorio donde se guardan los ficheros ui_*.h
UI_DIR = ui_headers#En funcion de la configuracion se decide donde se almacenaram
CONFIG(debug, debug|release){
MOC_DIR = moc_debug
OBJECTS_DIR = obj_debug
RESOURCES_DIR = resources_debug
DESTDIR = ../bin/debug
}CONFIG(release, debug|release){
MOC_DIR = moc_release
OBJECTS_DIR = obj_release
RESOURCES_DIR = resources_release
DESTDIR = ../bin/release
}#Añadimos las rutas donde buscara el compilador para buscar cabezeras
INCLUDEPATH+= include ui ui_headers ../
INCLUDEPATH+= src/ply
unix{
INCLUDEPATH+= /usr/include
INCLUDEPATH+= /usr/local/glew/include/GL
}win32{
INCLUDEPATH+= ../glew/include/GL
INCLUDEPATH+= ../glm
}#Indica a qmake donde tiene que buscar dependencias, de esta manera si modificamos un .h
#los .cpp que dependan de el seran recompilados
DEPENDPATH += include ui src ../ @and in the application .pro I add glew library like this:
@unix{
LIBS += -L/usr/local/glew/lib -lGLEW
}@Thanks for the help!!!
-
Mac OS X Mavericks brings in OpenGL 4 support. Previous versions used 3.2 only.
I am not experienced in OpenGL coding with Qt, but I think you need to properly initialise it using Qt functions (and best use Qt functions to develop, too). You can ping "ZapB":https://qt-project.org/member/3246 here on the forum for more info. Hope he does not mind ;)
-
Hello,
Thanks for answering!
I have Mac OS X Mavericks installed so it is not the problem! ;)
I have all my code with glew, not with qt functions... Change it all could be too much work...
Maybe anyone knows if it is possible to work with glew and not with qtfunctions....
Thanks!
-
Hello,
I have used the qglformat functions to create the context and it works if I use the core profile. With the compatibility profile i continue getting the 2.1 version...
I have tried to remove the glew, and everything is the same...
With the 2.1 OpenGL version, I get a GL_INVALID_OPERATION loading shaders. I can not understand 'cause this code works on windows perfectly... I have not proved with 4.1 'cause i should change more code...
Maybe am I forgetting something to migrate OpenGL code from windows to MacOS?
I'm starting to be desperated...
Thanks!
-
Remember that OpenGL 2.1 only supports GLSL 1.20.8.
Since the core profile works, why not use it? It will give you more modern possibilities and prevent you from using old, deprecated functions.