Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using QLibrary (setLoadHints)
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");
It didn't fix what I was trying to fix but for future reference.
@ QLibrary library2("glew32");
PS. If I didn't do this right, please let me know.
That should rather be:
Out of curiosity, why do you want to use glew like that ?
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.
Version 3.3 of what ?
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 author="SGaist" date="1416875638"]Version 3.3 of what ?
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.
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()?
[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.
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.
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.
And You'll need this too if you are using Visual Studio 2013.
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.
-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.