glxinfo vs. glewinfo interpretation - opengl

I have difficulties interpreting glxinfo and glewinfo.
glxinfo gives me this:
OpenGL version string: 3.0 Mesa 9.2.2
OpenGL shading language version string: 1.30
whereas glewinfo goes up to version 4.0:
GL_VERSION_4_0: OK
---------------
glBlendEquationSeparatei: OK
glBlendEquationi: OK
glBlendFuncSeparatei: OK
glBlendFunci: OK
glMinSampleShading: OK
I know that I cannot use GLSL newer than 1.30, but I'm wondering, is that a driver issue?
My GPU is
VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
I'm using Arch Linux and SDL, and have Mesa 9.2 and Mesa-libgl 9.2.2 installed.

When glewinfo reports certain functions being there, that just means it could retrieve a function pointer for them. However the function pointer being available does not tell, that the corresponding extension/version support being actually available. Since OpenGL follows a client server model, the client side interface may very well expose also newer functionality, while the server side doesn't support it.
The list of supported extensions and the reported version are the authorative information on that and you must rely on only those.

Related

New mesa installed but glxinfo show the older one

I am doing some work using Google Cloud Platform,that's to say I use ssh to login. When I run a script(mayavi/test_drawline.py) from others, it tells me:
ERROR: In /work/standalone-x64-build/VTKsource/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx, line 797 vtkXOpenGLRenderWindow (0x3987b00): GL version 2.1 with the gpu_shader4 extension is not supported by your graphics driver but is required for the new OpenGL rendering backend. Please update your OpenGL driver. If you are using Mesa please make sure you have version 10.6.5 or later and make sure your driver in Mesa supports OpenGL 3.2.
So I think I need to up upgrade my mesa. Before that, the glxinfo shows:
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL version string: 1.4 (2.1 Mesa 10.5.4)
I followed the instruction from How to upgrade mesa, but the glxinfo didn't change.
And I tried to compile Mesa from source code. So I followed the instruction from Mesa official website Compiling and Installing. I use
Building with autoconf (Linux/Unix/X11). All things are OK, it seemed that I have installed the newest Mesa.
However, when I run glxinfo| grep version again, it still like this:
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL version string: 1.4 (2.1 Mesa 10.5.4)
I have tried reboot, but it doesn't work.
So, does anyone know how to solve it?
Thank you!
The OpenGL version reported depends on the available Mesa version only be second degree. You're reported GLX-1.4 and OpenGL-1.4 which is an absolute baseline version dating back over 15 years ago. So this is not a Mesa version problem.
What far more likely is, that you're trying to create a OpenGL context in a system configuration which simply can't do more than OpenGL-1.4 without resorting to software rendering. Now one reason for that could be, that you're connecting via SSH using X11 forwarding. In that case all OpenGL commands would be tunneled through the X11 connection (GLX) to your local machine and be executed there. However GLX is very limited in it's OpenGL version profile capabilities. Technically it's supporting up to OpenGL-2.1 (which is the last OpenGL version, that defines GLX transport opcodes for all its functions). But a given configuration might support less.
If the remote machine does have a GPU, you have to use that. A couple of years ago, this would have meant running a Xorg server there. Not anymore. With NVidia GPUs you can use headless EGL. With Intel and AMD GPUs you can also use headless EGL, or use GBM/DRI to create a headless GPU accelerated OpenGL context. Of course this requires a GPU being available on the remote end.
If you don't have a GPU on the remote site, you must use some software implementation. Which with Mesa unfortunately doesn't work with a forwarded X11 session. Your best bet would be running something like Xpra, or Xvnc (i.e. some kind of remote framebuffer), where the X server runs on the remote end, so that the GLX connection terminates there, and not on your local machine.
Or you somehow coax the program you're building to use OSMesa (Off-Screen Mesa), but that requires entirely different OpenGL context setup, entirely different from what's done with GLX, so your VTK application may not work out of the box with that.

xming 7.7.0.23 OpenGl version reported incorrectly

I'm trying to use xming to render software using OpenGl running on the same machine in WSL / windows bash.
This works fine for some really small demos, however once I try something like glmark2, it fails because it seems the OpenGl version is reported incorrectly.
glxinfo | grep OpenGL reports this:
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 970M/PCIe/SSE2
OpenGL version string: 1.4 (4.5.0 NVIDIA 382.05)
If I let xming run on my internal graphics card (using a laptop), it reports
OpenGL vendor string: Intel
OpenGL renderer string: Intel(R) HD Graphics 4600
OpenGL version string: 1.4 (4.3.0 - Build 20.19.15.4568)
The weird part is the 1.4 in front of 4.5.0 NVIDIA 382.05.
The OpenGl support is definitely at least 3, because a demo using GLSL shaders which require newer OpenGl runs, but the version string is kinda garbage.
The problem you're running into is, that the GLX portion of XMing does support only up to OpenGL-1.4. The part inside the parentheses is the version string as reported by the system native OpenGL implementation. However since XMing lacks (so far) the capability to reliably pass on anything beyond OpenGL-1.4 it will simply tell you "all I guarantee you to support is OpenGL 1.4, but the system I'm running on could actually do …".
Maybe some day someone goes through the effort to implement a fully featured dynamic GLX←→WGL wrapper.

Is it possible to use OpenGL 4.5 features with latest mesa libraries?

I want to use latest OpenGL features on Ubuntu. And I have installed mesa-common-dev but as far as I understand mesa does not support OpenGL 4.5 features. Also how can I use OpenGL via hardware without any API ?
Note :
glxinfo | grep "OpenGL version"
OpenGL version string: 4.5.13397 Compatibility Profile Context 15.20.1046
I want to use latest OpenGL features on Ubuntu. And I have installed mesa-common-dev but as far as I understand mesa does not support OpenGL 4.5 features.
All that matters is, that your actual OpenGL implementation supports the profile you want. The Linux ABI on OpenGL is pinned to OpenGL-1.2 (LSB5 has been released recently, so expect upcoming distribution releases to follow it, which bumped it to OpenGL-2.1).
Anything that goes beyond the ABI requirements is done through the extension mechanism. I.e. use load function pointers through …GetProcAddress and introduce new tokens with a glext.h. This processes has been repacked into OpenGL extension wrapper-loader libraries like GLEW.
The stuff mesa-common-dev provides is what's written down in the Linux LSB ABI specs… in a vendor neutral way, so you can compile your program using mesa-common-dev stuff, but it will work with the NVidia or AMD/ATI drivers as well.
Also how can I use OpenGL via hardware without any API ?
By definition you can't. OpenGL is an API. If you remove the API you remove OpenGL. If your intention is working the naked GPU on the bare metal, well, that would boil down to writing a full driver. In a few weeks/months Vulkan will be released and this gets you much closer to the GPU than OpenGL.

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

I have had a lot of problems / confusion setting up my laptop to work for OpenGL programming / the running of OpenGL programs.
My laptop has one of these very clever (too clever for me) designs where the Intel CPU has a graphics processor on chip, and there is also a dedicated graphics card. Specifically, the CPU is a 3630QM, with "HD Graphics 4000" (a very exciting name, I am sure), and the "proper" Graphics Processor is a Nvidia GTX 670MX.
Theoretically, according to Wikipedia, the HD Graphics Chip (Intel), under Linux, supports OpenGL 3.1, if the correct drivers are installed. (They probably aren't.)
According to NVIDIA, the 670MX can support OpenGL 4.1, so ideally I would like to develop and execute on this GPU.
Do I have drivers installed to enable me to execute OpenGL 4.1 code on the NVIDIA GPU? Answer: Probably no, currently I use this "optirun" thing to execute OpenGL programs on the dedicated GPU. See this link to see the process I followed to setup my computer.
My question is, I know how to run a compiled program on the 670MX; that would be 'optirun ./programname', but how can I find out what OpenGL version the installed graphics drivers on my system will support? Running 'glxinfo | grep -i opengl' in a terminal tells me that the Intel Chip supports OpenGl version 3.0. See the below information:
ed#kubuntu1304-P151EMx:~$ glxinfo | grep -i opengl
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile
OpenGL version string: 3.0 Mesa 9.1.3
OpenGL shading language version string: 1.30
OpenGL extensions:
How do I do the same or similar thing to find out what support is available under 'optirun', and what version of OpenGL is supported?
Update
Someone suggested I use glGetString() to find this information: I am now completely confused!
Without optirun, the supported OpenGL version is '3.0 MESA 9.1.3', so version 3, which is what I expected. However, under optirun, the supported OpenGL version is '4.3.0 NVIDIA 313.30', so version 4.3?! How can it be Version 4.3 if the hardware specification from NVIDIA states only Version 4.1 is supported?
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.

Can I programming OpenGL4+ in a card that support 2.1 only?

This is the OpenGL version I have:
Video Card Vendor: Intel
Renderer: Intel(R) HD Graphics
OpenGL Version: 2.1.0 - Build 8.15.10.2622
GLU Version: 1.2.2.0 Microsoft Corporation
I'd like to learn the latest OpenGL API. But my card supports only 2.1 (and I cant update). Is it possible to program in latest API even with no card support?
AshleysBrain's answer is not quite correct. You can use a software implementation of OpenGL such as Mesa3D which can execute newer code using your CPU instead of your GPU. It will be slower but will allow you to compile and run your 4+ code against it OpenGL 3.1 code against it.
Edit: just checked, it seems Mesa only supports up to OpenGL 3.1. Still; that's pretty good for free.
It's more to do with what version the driver supports. Try updating your driver and see if it supports a newer version. Otherwise I'm afraid you're stuck with that version, there's nothing else you can do!
Send money/time Mesa's way in the hope they'll support GL4 in their software rasterizer sometime soon.
Or pester Khronos for a reference implementation.
As of Mesa 20.2 llvmpipe supports OpenGL 4.5.
Intel(R) HD Graphics are usually onboard.So NO you can't use GPU accelerated OpenGL 4.2 with this.You need dedicated card like those of Nvidia.The highest version of OpenGL I have seen on the dedicated cards is 3.1 which still delivers fixed pipeline API with Shaders support.But OpenGL 4.2 has completely removed all this and uses programmable way of doing things which requires programmable hardware too.