Where can I compile the opengl source to generate libraries? - qt

Where can I find a program which can be executed on Visual studio to compile openGL sources and generate libraries like opengl32.lib, glut32.lib, etc. In fact I have a problem of version with QT. I want to execute opengl using QT but without QT Opengl API.
Here's the error message :
lnk2026 module unsafe for safeseh image opengl32.lib
I'm really lost.
Thanks in advance for your help.

OpenGL is a specification, not a library with a defined source code. OpenGL implementations are what you use, and most of them are propietary. Some of them are open source (such as MESA), but in general you do not have public access to the source code.

The "Open" in "OpenGL" refers to the nature of the specification, not to the concept of "open source". OpenGL is "Open" in that the specification is freely available and can be implemented by anyone (modulo patent claims).
So while you can compile free-standing implementations of OpenGL, what your operating system provides (in your case, via opengl32.lib and opengl32.dll) is not something you can compile yourself.

Related

How to use OpenCL 2.0 kernel language in Qt Creator?

Several days ago, when I started to learn OpenCL, I needed a good IDE to write OpenCL C kernel language, which provides some basic functions like syntax highlighting and static analysis. I was surprised to find out that Qt Creator is able to do the job.
Everything was fine until today I started to use some feature in OpenCL 2.0:
It looks like Qt Creator use libclang to do the parsing and libclang treats my source files as OpenCL 1.0. But My machine supports OpenCL 3.0 and the code was ok to compile and run. So I doubt it only supports OpenCL 1.0.
My questions are:
How to make Qt Creator (or the libclang plugin in it) support OpenCL 2.0?
How do you guys write OpenCL 2.0? Is there any better IDEs or editors?
Thank you guys, I am really a newbie here.
I tried to rename the file's postfix to ".cl2", but it doesn't work.
I read the OpenCL support documentation of LLVM, but failed to find out the solution.
QtCreator uses KDE syntax highlighting engine. The definitions are simple XML files. You can find them here, but opencl.xml doesn't look updated for 2.0/3.0 language. You can try to change it, and then put it into $HOME/.config/QtProject/qtcreator/generic-highlighter/syntax and it should pick it up.
In QtCreator, you can download newer definitions by going to Tools -> Options, select "Text editor" in left, then "Generic highlighter" tab. This will put the updated files in $HOME.local/share/org.kde.syntax-highlighting/

Out-of-tree galcore build causing Qt seg fault

I use Yocto (Krogoth) to build my imx6 images and toolchains, however it's a bit heavy and slow for working on kernel drivers. As such my dev cycle is to build the kernel on its own, just using the output of a "do_patch" run in yocto as the source tree base and sourcing the toolchain environment.
This is normally not a problem, as mostly I'm focussed at that end of the s/w stack. However, I now need to be able to run a Qt application (running under eglfs) on top of my continually updated kernel, for a bug hunt. To do this, I need the imx6 graphics driver working, so I get the galcore source from git://github.com/Freescale/kernel-module-imx-gpu-viv.git export my kernel build directory, make it and deploy it. That module loads perfectly. However running the working application that has already been built with Yocto causes a crash, somewhere in libQt5EglDeviceIntegration.so.5. All the libs etc. are part of the original working image, the same place I took my kernel source from.
What do I need to do to make this work? Is there some part of Qt tied to the graphics driver that's going to force me to rebuild the entire library? What's the relationship between galcore.ko and Qt? Is there now a weird dependency between my application and the linux kernel?!
EDIT: PEBCAK. I'm an idiot. I didn't check out from the right SHA1 (that listed in the recipe) for the galcore driver. Still, the answer below is instructive, so I'd like to keep this question.
What do I need to do to make this work?
No idea. Maybe your self-built galcore.ko is incompatible with the binary blob OpenGL libraries from Freescale somehow? Does the original galcore.ko work correctly? How does the backtrace look?
Is there some part of Qt tied to the graphics driver that's going to force me to rebuild the entire library?
No need to rebuild Qt. While Qt is linked against the OpenGL library, the OpenGL ABI/API is stable and therefore a Qt rebuild isn't needed. Besides that, you aren't changing the OpenGL libraries.
What's the relationship between galcore.ko and Qt?
Qt uses OpenGL for rendering when using QtQuick. The OpenGL library (libGL.so and a few variants like libGLes2.so) is provided by Freescale as a binary blob. The OpenGL library makes syscalls that end up in the galcore.ko kernel module.
libQt5EglDeviceIntegration.so.5 is the part in Qt that does the first OpenGL calls to initialize OpenGL.
Is there now a weird dependency between my application and the linux kernel?!
Well, yes, indirectly via Qt -> libGL.so -> kernel [galcore.ko]

OpenGL program does not compile with QT 5.0

I followed this turial to create a very simple openGL program with QT.
I have QT 5.0. I created a new empty QT project, created all files as in the tutorial but the compilation failed. The cause is that certain methods like glShadeModel() are not recognized.
I tried include GL/glu.h (which include glShadeModel for instance) but this time there is a conflict with several openGL types. But according to the tutorial all opengl methods should be included in QtOpenGL. Maybe I have a too much recent version of QT. I'm lost.
Does anyone can help me ?
Qt5 is based on OpenGL ES 2.0, and this is a subset of desktop OpenGL, even some Qt tutorials are not adapted to this change yet. You will have to build Qt 5.0 with normal OpenGL if you wish to compile those tutorials.
i may only give you some points to check.
in .pro
*QT += opengl
*check your GPU for supporting the opengl version you are using, for example my laptop is only compatible with 2.1 opengl.
also please use "Qt" instead "QT", QT stands for quicktime by Apple.

Re-built Qt5.0.2 with OpenGL, how to use with Qt Creator

I need to move my code from a C++/OpenGL and Config.txt situation to a UI friendly space. I was told here to try Qt and installed it in Windows.
The issue I ran into is that it did not support the OpenGL version I needed out of the box and I had to rebuild with the -opengl desktop parameter.
First time doing this, but was able to follow the instructions (and a ton of Google) and it "succesfully" was built. My issue now is I am unsure how to make the files I have work with Qt Creator.
I copied over all the folders from the qt5 folder created by git over to the Src folder in Qt5.0.1/5.0.1/Src but the hellogl example still wouldn't build.
I checked the options and it was pointing to a qmake in Qt5.0.1/5.0.1/msvc2010/bin so I copied over the qmake.exe from qtbase/qmake over to this folder (renaming the old one) and now Qt Creator builds the hellogl example on my Windows system.
My worry is, did I do this the right way? I fumbled around and got something, but is this the way I should have proceeded after I built the qt5 from git? If not what was the way I should have gone about making it all work with the Qt Creator?
The typical way to utilize the modern OpenGL the feature set (post fixed-function pipeline) in Qt is by utilizing a extension wrangler (GLEW) that finds all the OpenGL functions your graphics drivers support BEFORE Qt includes any OpenGL headers.
To accomplish this simply do the following:
If you already haven't, download GLEW (or another extension wrangler if you wish) and install it in your system path. I would recommend the 32 bit package as it will be easier to work with.
#include glew.h in your source code before any other Qt header includes that may use OpenGL headers. Just to be safe, make glew.h the first header included in your source code.
In your Qt project's .pro file add the line LIBS += -lGLEW (mac/linux) or LIBS += -lglew32 (windows).
Note: Beware of using Qt OpenGL wrappers when implementing an application that uses post fixed-function pipeline facilities. Qt 5's OpenGL wrappers all operate using the OpenGL ES 2.0 specification which may cause problems when interleaved with your OpenGL 3/4 code. Even QPainter can become troublesome when performing overpainting on a QGLWidget due to it's heavy use of the fixed-function transformation stack. I am currently developing a library called QGLX that provides alternative Qt wrappers designed for complying to the modern desktop OpenGL specification. The beta will hopefully be released by the end of this year for Qt 4 & Qt 5.

Does Qt creator by default statically or dynamically link it's libraries?

I'm developing a closed source application and to do so in accordance with the LGPL I have to dynamically link Qt's libraries to my application. Does Qt do this by default or do I have to take steps to do so? If that's the case how would I go about doing it?
Qt uses dynamic linking by default.
You'll notice this immediately during deployment to a non-developer machine, because your code will not run without the Qt libraries.
If your concern is the LGPL, just be careful when compiling Qt itself. Most LGPL violations with Qt are not because of static linking (since dynamic is the default), but for compiling Qt with non-default parameters.
LGPL is not just that the library must be provided along your binaries, but also that you specify how your users can build themselves the LGPL part. If you compile Qt yourself and do not use the pre-compiled binaries from the website, you must document that part of your build configuration in your release!
As soon as you get something running on your program, start preparing a release version for a non-developer environment without Qt installed. Your program should fail as soon as you delete the DLLs that you must copy along your program (or whatever format your OS uses).
It does it by default, statically linking seems to be quite involved judging by the many questions on the site regarding it.

Resources