I want to use GLEW with Qt under Windows (7 if that matters).
What I did was go to the GLEW website, download the package for windows, then put the glew.dll in System32 folder. In my pro file, I referenced the .lib files with LIBS += .../path_to_the_libs/glew32.lib and the same for glew32s.lib (not sure what the latter's for). In my QGLWidget subclass, I made sure that glew.h is included before <QGLWidget> and therefore before gl.h and glu.h. In the main() function the first thing I do is call glewInit and call glGetError but my application exits with some weird code, like a very large negative number.
I have a suspicion that there are very may thing I do wrong(I am relatively new to Qt and OpenGL and absolutely new to GLEW), but I also have a suspicion that one of the major errors is that the libs, I suppose, were built with MSVC and therefore cannot be linked against with MinGW... Anyway, can anyone please provide a step-by-step instruction how to install GLEW with Qt and use it? I would much appreciate it. Thank you in advance
Edit:
Guys, maybe I am asking for too much, but I would really really like a step-by-step instruction :)
You're not supposed to call glewInit() before you have your OpenGL context ready. Call it just before your first gl* calls, not at the beginning of main. That should do the trick.
Also, don't use glew32.lib and glew32s.lib simultaneously - the former is to use along with the DLL file and the latter is static (your .exe gets bigger but you don't have to distribute your application with the .dll). Decide and use either.
Qt 4.7 can create any OpenGL Context. Use QGLFormat.setProfile() and QGLFormat.setVersion()
The only disadvantage is that you still do not have OpenGL 3+ bindings.
Step by step solution:
Make new subclass of QGLWindget.
In constructor of new class set up new QGLContext with proper OpenGL numbers.
Call glewInit().
Pass context to constructor QGLWidnet.
If I remember correctly it should do! GLEW dll should be placed in proper system folders, and compiler options attached, but they are the same as for GLEW without QT.
Related
I am trying to make a "hack" for a really old game. My dll injector does not resolve dll import and everything work just fine except D3DCompile function that is causing access violation. After long debugging session I figured out that it is causing this error because my code is referencing to d3dcompiler_47.dll but game has only d3dcompiler_43.dll in it. My question is where can I get corresponding libraries that will (after including to project) use d3dcompiler_43.dll?
Only thing that I have found was a dll D3DCompiler_43.dll which was inside Jun2010_D3DCompiler_43_x64.cab.
Where can I find the header files and lib files for this d3d compiler version?
EDIT: Found all files in Unreal Engine source code.
D3DCompiler is normally part of the windows SDK, which can be found at here. Note that if your game is old enough you may need to download an older version of the SDK (if it uses Direct3D 9 or earlier for example) but I can't tell you exactly how far back you would need to go.
I need help with installation pthreads to qt.
the thing is I'm making project with winpcap and pcapplusplus wrapper for it. but it still needs pthreads. I have pthreadgc2.dll missing, and I cant figure out how to connect it to my qt project. Basically, program compiles, but crashes once I try to start it in qt. So, I dont really need the pthread and qthread were distributed with qt, I need exactly these libraries: http://ftp.ntua.gr/mirror/mingw/MinGW/Base/pthreads-w32/pthreads-w32-2.9.1/pthreads-w32-2.9.1-1-mingw32-dev.tar.lzma
but there are no dll files either, and I cant understand how to build project with it.
and yes, I'm sure which dll I need, I checked it with dependency walker, but I dont know where to find it. Hope to your help, folks.
Not all downloadable versions of MinGW work well with pthreads.
There is:
https://sourceforge.net/p/mingw-w64/wiki2/Compile%20pthreads/
that does but I would recommend using TDM-gcc instead, http://tdm-gcc.tdragon.net/.
It is more actively maintained and pthreads work out of the box.
You can then simply link with -lpthread in your linking stage
I'm trying to set up a project with freeglut and openGL for an assignment, and I haven't touched c++ in a while, so I'm about to blow my brains across my screens trying to configure dependencies, and figure out which set of conflicting instructions to follow, etc.
Is there some kind of pre-built template project I can just download, open a .sln file and have everything work? With the proper dll's referenced in project settings, and headers included, and whatever else? Just some kind of a baseline so I can actually get to coding, rather than dealing with this garbage?
I feel like it must exist. Please let it exist.
Although it is probably not a complete answer to your question, here is a check-list:
GL\glui.h
GL\glut.h
glu32.lib
glui32.lib
glut32.lib
opengl32.lib
Ignore libcd.lib under Release mode.
glut32.dll
The GLUI library can be found at http://www.cs.unc.edu/~rademach/glui.
The GLUT library can be found at http://www.pobox.com/~nate/glut.html.
You can have a look at this OpenGL project, though it's like 10 years old or something (on VS 6.0): http://planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=10256&lngWId=3
I am running in situation where I have two different versions of Qt installed, the compiled with mingw one, and the other with visual studio.
Now, When I compile my program with Qt MinGW version and run it, I got a message have scrambled text, saying that one of essential Qt modules not loaded.
My question is, how I can set the path to Qt essential modules for my application with C++. I looked at documentation and found addLibraryPath method but it seems like for Qt plugins only.
Edit
It seems I misunderstood the question, as SIFE comment that he needs to load Qt modules (like QtGui4.dll), not plugins. The answer for plugins is left here, in case it might help someone.
Plugins
Qt loads plugins that are in the SDK/plugins by default. The problem is, it finds the wrong SDK first...
If I remember right, Qt first search in the directory .. So you can copy the 'plugins' directory near your *.exe : plugins for msvc copied near the msvc-compiled exe, and plugins for gcc near gcc-compiled exe.
If you do not want to copy the plugins directory, you can use setLibraryPaths (not tested, but might work)
Last but not least, you can also use the qt.conf approach.
Modules
Modules are not dynamically loaded, in the sense that they're part of the dependencies of the application, so they are loaded at exe startup, and not via LoadLibrary. So, the solution is simple: just copy the dlls in the same folder than the one containing the *.exe
Concerning compiler, the proper library/include settings should be done by QMake.
QMake creates your makefile/VS-Project using the libraries found in the same Version Qmake belongs to.
Try calling QMake using the complete path explicitely for each Qt-Version
e.g.
c:/myQtMinGwProject>c:/Qt4_mingw/bin/qmake
c:/myQtVSProject>c:/Qt4_VS2008/bin/qmake -t vcapp
Concerning run-time, make sure the dlls for corresponding version are in PATH
I hope it helps
I'm teaching myself OpenGL and I'm implementing ttf text rendering using FreeType 2. I downloaded the library from
http://gnuwin32.sourceforge.net/packages/freetype.htm
and after a couple of minor issues I got it running properly. The thing that's bothering me is that I have to place a copy of freetype6.dll in the directory with my executable in order for the thing to run. I generally try to avoid a bunch of unnecessary dll files floating around. I'm sort of new to windows programming, but from what I understand most libraries can be built to run fully from a lib rather than requiring a dll at runtime. Looking through the documentation from FT is making my brain melt, so I thought I would ask here to see if there were any devs that have worked with FT before and if so, do they know how to build the library such that no dll is required at runtime.
Thank you in advance for any advice or support.
Check out this link. See the section Optional: Installing FreeType (by compiling it yourself)
Follow the instructions and you'll be good to go.
you can generate static lib by getting source code of it... then you won't need dll...and i think freetype2's source is available...
It is something DLL generic. All your DLLs should be in PATH similarly to LD_LIBRARY_PATH. Also under Windows (unlike Unix) the current directory is always in the PATH. So you just need to set your PATH variable to point to location of this dll.
Now, for Unix... you probably just have this library installed by default like hundreds of other useful libraries that are not present under Windows by default.
So... No unless you link statically you should use DLL somehow. And my suggestion - use dll.