Open-Source Opengl Profiler for Linux

Open-source OpenGL profiler for Linux

Have a look at BuGLe. Its main target is not profiling, but it has a filter, which shows the time spent in each OpenGL call.

Starting to learn OpenGL. On modern Linux, how are all these concepts related?

OpenGL is an interface. To use it, you need an implementation. There are many implementations of OpenGL. Because each implementation is different, your program will behave differently when you run it with different implementations, even though your program is the same. A typical OpenGL implementation with a hardware renderer will consist of some code that runs in user space (a dynamic library), code that runs in the kernel (the device driver), code that runs in your X.org server (the DDX driver), and code that runs on the graphics card itself (the firmware). That's four different pieces of code!

AMD and nVidia provide proprietary OpenGL implementations for Linux. These implementations have closed-source drivers which taint the kernel, which means that if something goes wrong, the Linux developers can't help you. They support recent OpenGL versions (e.g. 4.5, if your hardware is capable) with the full compatibility profile support.

Mesa provides an open-source OpenGL implementation for Linux. This implementation can use the Noveau or Radeon open-source drivers, which do not taint the kernel. Mesa also has a software implementation, called llvmpipe, which runs on your CPU only and doesn't need drivers. It's impressively fast for what it is, but it is much slower than even an outdated hardware implementation. Mesa recently started supporting OpenGL 4.x series, but it will take some time before it filters through distro release cycles, so you're more likely to see OpenGL 3.3--and that's only for the core profile, you're limited to 3.0 with the compatibility profile (similar to how it works on OS X).

Because Mesa developers have limited access to documentation about the graphics cards, and limited development resources, the Mesa implementation on your AMD or nVidia card is usually slower than the vendor's implementation, and it usually supports fewer OpenGL extensions. However, the Mesa implementation is very solid, it doesn't taint your kernel, and some of the Mesa implementations are even Valgrind-clean.

Installing OpenGL just means installing an OpenGL implementation on your system (you know, with dnf or apt or whatever). This usually means a choice between the vendor implementation and the Mesa implementation... except for Intel integrated graphics, where Mesa is the vendor implementation.

Create OpenGL core profile under GLFW

I found this to be largely a GLFW version issue as genpfault and Brett Hale pointed out. Once I ported the offending code to GLFW 3 the issue disappeared. I also updated to a newer version of the GLM library. For those who are playing with opengl-tutorial.org, I suggest taking it as an exercise to rewrite the code using updated libraries as the ones supplied are very old at this point.

OpenGL core profile not available despite glxinfo asserting is available

Mesa's generally going to give you a GL 2.1 or 3.0 context unless you ask for something higher.

Use glfwWindowHint() before glfwCreateWindow() to set the GL version and Core-ness to request:

glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 2 );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );

How can I check which Version of OpenGL is supported on a linux system with optirun?

You can just run glxinfo under optirun:

optirun glxinfo | grep -i opengl

Both cards have different features, so its normal to get different OpenGL versions.

Linux: use OpenGL 4.x

Just linking to libGL.so is all that is necessary to use the hardware graphics driver.

If you have an NVIDIA or AMD graphics card and you have installed the nvidia or fglrx driver, you will get the maximum OpenGL version supported by your video card.

If you instead are using the open source nouveau, radeon, intel, or other graphics driver, Mesa will take over and you will have only the maximum version of OpenGL supported by Mesa (3.1) and the driver for your hardware. It will automatically use all hardware features it's capable of using.

You do not need to do any fancy dlopen tricks or anything else.



Related Topics



Leave a reply



Submit