Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Old OpenGL Version [Qt5, QtCreator, MacOs, GLEW]
Forum Updated to NodeBB v4.3 + New Features

Old OpenGL Version [Qt5, QtCreator, MacOs, GLEW]

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dianyu
    wrote on 31 Mar 2014, 11:13 last edited by
    #1

    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!!!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 31 Mar 2014, 11:30 last edited by
      #2

      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 ;)

      (Z(:^

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dianyu
        wrote on 31 Mar 2014, 12:33 last edited by
        #3

        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!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dianyu
          wrote on 2 Apr 2014, 10:46 last edited by
          #4

          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!

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 2 Apr 2014, 10:51 last edited by
            #5

            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.

            (Z(:^

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dianyu
              wrote on 2 Apr 2014, 10:55 last edited by
              #6

              Yeah..

              That's true...

              I should change all my code.. So I start doing it.. I will comment you how it goes...

              1 Reply Last reply
              0

              1/6

              31 Mar 2014, 11:13

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved