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. Using QLibrary (setLoadHints)
Qt 6.11 is out! See what's new in the release blog

Using QLibrary (setLoadHints)

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 3.5k 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.
  • C Offline
    C Offline
    cartrite
    wrote on last edited by
    #1

    I am trying to load glew at the start of an app. I can use QLibrary to load the glew32.dll file but when I try to use setLoadHints I get compile errors. Any idea on setting the LoadHint to ResolveAllSymbolsHint. Apparently this will resolve all the symbols in the library.
    This is what I tried along with many variations but all get compile errors.
    @ QLibrary library("glew32");
    library.load();
    library.setLoadHints("ResolveAllSymbolsHint");
    @
    cartrite

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cartrite
      wrote on last edited by
      #2

      Never Mind.
      It didn't fix what I was trying to fix but for future reference.
      @ QLibrary library2("glew32");
      library2.setLoadHints (QLibrary::LoadHints(0x01));
      library2.load();@

      PS. If I didn't do this right, please let me know.

      cartrite

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        That should rather be:

        @library2.setLoadHints (QLibrary::ResolveAllSymbolsHint);@

        Out of curiosity, why do you want to use glew like that ?

        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
        0
        • C Offline
          C Offline
          cartrite
          wrote on last edited by
          #4

          I'm trying to debug a program that crashes when it trys to use gl functions. It uses glew. But for some reason, I can't initialize it.
          The glfuntions that crash the program try to generate pre-computed textures and store them in memory till needed. It doesn't try to draw anything.

          After disabling glew from being built in the program, I was trying to load and resolve the symbols from a version I built separately but that did not help. Still crashes and it seems the program has only opengl1.1 capabilities. Windows default.

          It seems that after a messagebox is opened, the program runs fine and all available glfunctions work. I have version 3.3. I am trying to figure out why.
          And Thank You for your response.
          cartrite

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Version 3.3 of what ?

            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
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Common cause of this sort of crashes is when you try to call glewInit() before the OpenGL context is created or somewhere where there's no context set as current.
              Where do you call glewInit()?

              1 Reply Last reply
              0
              • C Offline
                C Offline
                cartrite
                wrote on last edited by
                #7

                [quote author="SGaist" date="1416875638"]Version 3.3 of what ?

                [/quote]
                That's the version of GL on my laptop.

                [quote author="Chris Kawa" date="1416877989"]Common cause of this sort of crashes is when you try to call glewInit() before the OpenGL context is created or somewhere where there's no context set as current.
                Where do you call glewInit()?[/quote]

                I don't think you understand. First it's 3rd party software called vesta that is causing the crash. A graphics engine. It doesn't use glewInit. But it still crashes. The main program calls the vesta engine to generate textures. But all the gl statements in the program that does this are disabled or are not being used correctly. After a glTexImage3D is used, the program dies on the next line from a segmentation fault before it even completely starts .

                I was trying to create a gl context to allow it to run.That is when I would use glewInit. But everything I tried so far is ignored.
                The context seems to be done for me if I exec a messagebox. As soon as the messagebox closes, I seem to have all the capabilities that the laptops version of GL will allow and the program runs fine. I'm trying to figure out why. Then that may give me a clue as to where and how a gl context should be created and made current without having to open a messagebox. And since this is 3rd party software doing this, I'd rather not change it but would rather change the main program somewhere before the vesta engine is called.

                PS. I was thinking that using qlibrary to load the glew32 during startup might have allowed this to work but it didn't. So I'm looking into other possibilities.
                cartrite

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  bq.
                  I don’t think you understand. First it’s 3rd party software called vesta that is causing the crash. A graphics engine. It doesn’t use glewInit

                  It doesn't matter which party it parties on ;) It uses OpenGL calls like that glTexImage3D and for that a valid context must be created, made current and glewInit must be called in that context to resolve function pointers. Otherwise the name glTexImage3D is not resolved garbage and it will crash.

                  That is why I asked. So again - Where do you create context? is it valid after creation? Where do you make it current? is it current when you call glewInit()?

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    cartrite
                    wrote on last edited by
                    #9

                    [quote author="Chris Kawa" date="1416907088"] That is why I asked. So again - Where do you create context? is it valid after creation? Where do you make it current? is it current when you call glewInit()? [/quote]
                    That's just it. I didn't create a context yet. I've tried. But they are not valid. I can't even use something like glGetString(GL_VERSION) cause it always returned NULL.

                    The context is actually being created when I use a qmessagebox. Something I did. That is currently being called during menu set up.

                    Also, this is new to qt5? Reason for the question. No context that I can see was ever created to do the texture generating and it runs fine when built with qt4.8.

                    Note. This project has about 200+ files. It must go thru 6 or 7000 lines of code before it starts up. I'm not sure where to create a context yet.

                    cartrite

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      cartrite
                      wrote on last edited by
                      #10

                      If you want to take a look at this project, it is available here.
                      @ svn checkout http://cosmographia.googlecode.com/svn/trunk/ cosmographia @

                      The home page.

                      https://code.google.com/p/cosmographia/

                      You would need this patch to compile on windows or linux using qt5.2 or newer.

                      Unfortunately, I am not able to post patch code on this forum.

                      A workable copy can be found here.

                      http://forum.celestialmatters.org/viewtopic.php?p=12795#p12795

                      And You'll need this too if you are using Visual Studio 2013.

                      http://forum.celestialmatters.org/viewtopic.php?p=12800#p12800

                      cartrite

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        cartrite
                        wrote on last edited by
                        #11

                        I originally got into this a couple weeks ago to fix compile errors with qt5, but a few of us found it was crashing too. Another first seen it crash on windows, another with linux. The author uses a Mac. So I'm assuming that this works on a Mac without any changes. The port from qt4 to qt5 happened over a year ago.

                        cartrite

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          cartrite
                          wrote on last edited by
                          #12

                          -I'm totally confused now. I decided to track the flow of the program- .... Post removed. I wasn't tracking the flow of the program correctly.
                          cartrite

                          1 Reply Last reply
                          0

                          • Login

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