Novice Question -> Installing and using libraries in Linux (Mint): GLEW, GL, GLM
-
Hi.
Coming from a C#/DirectX education, I'm determined to make a switch towards OpenGL and trying to make platform independent projects. However, I'm just constantly bombarded with inconsistencies and problems that I'm not experienced enough to tackle just yet.
I'm trying to creating a stable, repeatable setup where I can create projects and add the libraries I need and just start learning to use them. Currently I'm trying to setup a simple development environment in Linux Mint to learn this stuff. Trying to be as open-source as possible in my development too.
I'm struggling to find an exact route to just install a library, link it to the project and use it. If I do ever get anything working, its always inconsistent between projects.
I just want to know how to install for example GLEW, link it to a plain C++ project and use "#include <GL/glew.h>" and start using it.
I'm constantly running into things like; download glew > put it here > run this make command = ungooglable errors. Or I'm running into things like; use "sudo apt-get install libglew-dev" which works fine. However I need a library file for Qt and can't find it anywhere. I've had all these libraries somewhat working in Windows a while ago so some consistency, but the process was seemingly completely different.
Can anybody take a minute to point me in the right direction. This has drove me nuts for over 6 hours now... :D
Thanks in advance.
Nay. -
Hi and welcome to devnet,
For your dependencies you essentially must install the dev packages needed (this will also pull the needed libraries). Unless you are using a very special library most of them are installable through the package manager.
Since you're on linux, you might want to use pkg-config (have a look at qmake's documentation to see how to integrate it) which will simplify the include/link handling for you.
Hope it helps
-
You can use cmake or qmake (personally i'd use cmake because it's more useful for "serious" projects.
You should also be preferring your distro packages for the library first. Your distro has both glew and qt..so I don't see what the issue is there.
you can take a look at my project (there's a qt branch if you wanna see the qt stuff too), but you can get the idea of how to find the lib and link to it (I use glew as well). https://github.com/sreich/ore-infinium
-
I can run my programs just fine in windows and linux (and Mac, and simbian, ... :) without glew and glm. With Qt, you really don't need them. QGLwidget will support opengl out of the box in Widows. In linux you will only need a library, I think it's libqt5opengl-dev (or libqt4opengl-dev) , that you install in your system with apt-get, so is not related to your project . You can use QMatrix to replace GLM.
If you're newbie, just keep it simple and forget about those libraries. -
yeah except qt's gl functions support sucks horribly even in 5.1, ime.
and you'd definitely want to use glm. qt has crap for matrices handling. simple things like projcetion, unprojection, zooming...inversing..
and also, GLM is SIMD optimized, I don't think qt's matrix stuff is. and is very similar to glsl in nature. especially for newbies, and since most tutorials out there use glm (for good reason).
oh and qmatrix is deprecated in 5.x, and you should not be using qt 4 at all if you don't have to. you're going to have a bad time with opengl.