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. glGetString(GL_VERSION) returns NULL
Forum Updated to NodeBB v4.3 + New Features

glGetString(GL_VERSION) returns NULL

Scheduled Pinned Locked Moved General and Desktop
16 Posts 4 Posters 10.7k Views 3 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.
  • P Offline
    P Offline
    Paul H.
    wrote on 12 Jul 2015, 14:44 last edited by
    #7

    Well, it is reporting different versions in the different environments. I would try running process explorer and see what dlls are being used for each environment.
    Paul

    1 Reply Last reply
    1
    • F Offline
      F Offline
      floatingWoods
      wrote on 12 Jul 2015, 21:22 last edited by
      #8

      Ok, so I used the process explorer, and noticed that the deployed application (i.e. the one not launched via QtCreator) is has libGLESV2.dll loaded. How come? I do not need GL ES, nor do I want it (my application still uses old OpenGL fixed-pipeline code).

      Searching the internet for libGLESV2.dll, I found out that libGLESv2.dll is distributed by Mozilla Foundation and used by Firefox 9.0.1 application. How come my application is using it? How can I prevent this?

      Thanks

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 12 Jul 2015, 22:01 last edited by
        #9

        Hi,

        IIRC, Qt on Windows loads at runtime either the OpenGL or ANGLE backend depending on what you have available on the machine where you run the application. You might be seeing that happening.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • F Offline
          F Offline
          floatingWoods
          wrote on 13 Jul 2015, 09:22 last edited by
          #10

          Thanks Samuel.

          I basically don't need OpenGL ES, I am just using old fixed-pipeline OpenGl commands (probably not much more than OpenGl 2.0). What are my options?

          I also tried to deploy the application by specifying that I don't want the ANGLE library (--no-angle), but then, I get a bunch of messages (then a crash) like:

          Failed to load libEGL.dll ...
          static QWindowsEGLStaticContext* QWindowsEGLStaticCOntext::create(QWindowsOpenGLTester::Renderers): Failed to load and resolve libEGL functions
          ...
          

          Thanks

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 13 Jul 2015, 20:51 last edited by
            #11

            How are you doing the deployment ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • F Offline
              F Offline
              floatingWoods
              wrote on 15 Jul 2015, 14:57 last edited by
              #12

              Sorry for the delay..
              I deploy the application (which is a library (loaded by an executable)) with:

              windeployqt --no-angle directoryToMyDll\myDll.dll
              

              It then tells me:

              To be deployed: Qt5Core Qt5Gui Qt5Network Qt5OpenGL Qt5Svg Qt5Widgets
              

              Thanks

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 19 Jul 2015, 15:06 last edited by
                #13

                I'm not sure I'm following you, you have a Qt application + library to deploy ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • I Offline
                  I Offline
                  IanMoone
                  wrote on 20 Jul 2015, 10:32 last edited by IanMoone
                  #14

                  I have the same issue :
                  https://bugreports.qt.io/browse/QTBUG-47105

                  I force Qt to use OpenGL instead of Angle and it's not enough, I also link statically openGL library.
                  The openGL context is necessary created cause, we call glGetString after the display of the splash screen of the application.

                  Edit:
                  I want to check the QOpenGLContext::currentContext() ptr, but I can't make it build, the QOpenGLContext header doesn't provide the class definition.

                  1 Reply Last reply
                  1
                  • F Offline
                    F Offline
                    floatingWoods
                    wrote on 21 Jul 2015, 10:03 last edited by
                    #15

                    I have prepared a minimalistic application that illustrates the problem.

                    The minimalistic application will build a QMainWindow, and set a QOpenGlWidget-derived widget as the central element. Then, in that widget, in the initializeGL function I check the GL_VERSION. When I run it from QtCreator, it works fine. When I deploy the application and I run it from the command line, it fails with the glGetString function.
                    Here the minimalistic application:

                    Project file:

                    QT			+=	widgets opengl
                    LIBS		+=	-lopengl32
                    QT			+=	core
                    
                    HEADERS		=	myGlWidgetClass.h
                    SOURCES		=	myGlWidgetClass.cpp \
                    			main.cpp
                    

                    The QOpenGLWidget-derived class (header):

                    #include <QOpenGLWidget>
                    class MyGlWidgetClass : public QOpenGLWidget
                    {
                    	Q_OBJECT
                    public:
                    	MyGlWidgetClass(QWidget *parent = 0);
                    	~MyGlWidgetClass();
                    protected:
                    	void initializeGL();
                    };
                    #endif
                    

                    The QOpenGLWidget-derived class (implementation):

                    #include "myGlWidgetClass.h"
                    MyGlWidgetClass::MyGlWidgetClass(QWidget *parent) : QOpenGLWidget(parent)
                    {
                    }
                    
                    MyGlWidgetClass::~MyGlWidgetClass()
                    {
                    }
                    
                    void MyGlWidgetClass::initializeGL()
                    {
                    	const char* gl_version=(const char*)(glGetString(GL_VERSION));
                    	if (gl_version==NULL)
                    		Beep(4000,500);
                    }
                    

                    And the application main code:

                    #include <QApplication>
                    #include <QMainWindow>
                    #include "myGlWidgetClass.h"
                    int main(int argc, char *argv[])
                    {
                    	QApplication app(argc, argv);
                    	QMainWindow myMainWindow;
                    	myMainWindow.setCentralWidget(new MyGlWidgetClass(&myMainWindow));
                    	myMainWindow.showNormal();
                    	return app.exec();
                    }
                    

                    I also have to mention again that this problem happens with Qt 5.5, but not with Qt5.1.1 (both on Windows 8.1). (with Qt5.1.1, simply replace QOpenGLWidget with QGLWidget (since QOpenGLWidget is new since Qt5.4))

                    Thanks

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      floatingWoods
                      wrote on 21 Jul 2015, 21:46 last edited by
                      #16

                      Hello again,

                      for your info: I am able to invert the problem with following code before building the application:

                      QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL,true);
                      

                      With invert, I mean that with above call, I can run my application from the command line, but not from QtCreator anymore (only a black screen in that case, not even the toolbar buttons are visible anymore)

                      Details and a demo application that illustrates the problem can be found here

                      Thanks

                      1 Reply Last reply
                      0

                      16/16

                      21 Jul 2015, 21:46

                      • Login

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