Linux check opengl version

How to tell which version of OpenGL my graphics card supports on Linux

I am trying to figure out which version of OpenGL my graphics card and driver currently support. This answer suggests running glxinfo | grep OpenGL which if fine, but here is (some) of that output:

OpenGL vendor string: NVIDIA Corporation OpenGL core profile version string: 4.5.0 NVIDIA 387.22 OpenGL version string: 4.6.0 NVIDIA 387.22 

So it is hard to tell, is it 4.5 or 4.6? Also the official documentation from nVidia does not mention the answer either!

1 Answer 1

OpenGL version string: 4.6.0 NVIDIA 387.22 

That is the highest legacy version the implementation will support. There are several possibilities here:

  1. This number will be
  2. It might be the highest supported compatibility profile version if the implementation does support the compatibility profile and actually returns a compatiblity profile context when asked for a legacy context
  3. It might also be = 3.2 in a compatibility profile, but chose to not expose it when asked for a legacy context.

The nvidia proprietary driver falls in category 2.

For the core profile, there is simply no way to ask the implementation what it can support, as described in this answer:

OpenGL core profile version string: 4.5.0 NVIDIA 387.22 

That glxinfo output does not mean that your driver can’t do 4.6 core. (It actually can). It just means that the glxinfo aren’t aware of the presence of GL 4.6 right now, only only check for up to 4.5.

The source code for glxinfo will reveal the following logic:

 if (coreProfile) < /* Try to create a core profile, starting with the newest version of * GL that we're aware of. If we don't specify the version */ int i; for (i = 0; gl_versions[i].major >0; i++) < /* don't bother below GL 3.0 */ if (gl_versions[i].major == 3 && gl_versions[i].minor == 0) return 0; ctx = create_context_flags(dpy, config, gl_versions[i].major, gl_versions[i].minor, 0x0, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, direct); if (ctx) return ctx; >/* couldn't get core profile context */ return 0; > 

so it just iterates through an array gl_versions and checks if a context with that version can be created.

And OpenGL 4.6 was added to that array in this commit on October 11, 2017:

diff --git a/src/xdemos/glinfo_common.h b/src/xdemos/glinfo_common.h index 0024f85..4d07f66 100644 --- a/src/xdemos/glinfo_common.h +++ b/src/xdemos/glinfo_common.h @@ -86,6 +86,7 @@ struct options /** list of known OpenGL versions */ static const struct < int major, minor; >gl_versions[] = < + , , , , 

So if you use a glxinfo which was compiled on a source code version before Oct 11 (which means basically every distro version right now), it simply will not show 4.6, even if your driver can do it.

So it is hard to tell, is it 4.5 or 4.6?

It is 4.6 for both compatibility and core profile. But I only know that because I know that driver.

Источник

How can I find out my OpenGL version on Ubuntu 13.04

Does this question even make sense? SFML 2.0 has added a feature whereby you can specify an OpenGL version to use. Is there a terminal command I can run (or otherwise) to find out what version I should be using?

@EdwardBird: Then your question is poorly phrased. If you wanted to know what the highest version of OpenGL supported by a system is, you should have asked for that. So fix your question.

2 Answers 2

To know your OpenGL version in Ubuntu,

$sudo apt-get install mesa-utils 
$glxinfo | grep "OpenGL version" 

You will get the output as follows,

glxinfo | grep "OpenGL version" OpenGL version string: 1.4 (2.1 Mesa 7.7.1) 

There is no "should be using". The version you "should" be using is the minimum version that you want to support. What version that is depends on what hardware you want your program to execute on. If the hardware can't support that version, then your code simply won't run on it. And if you want your code to run on lower versions, then you should have asked for that version and written your application against that lower version.

Well GTX 670MX supports 4.1, but clearly the information you give is not correct, because running SFML with version 3.2 specified causes problems.

@EdwardBird: What kind of problems? Nicol Bolas is right, and whatever's broken, it should not be due to a higher version being supported than what's requested.

Источник

What is terminal command that can show OpenGL version?

You may have better luck with modern OpenGL just grepping for "version" instead of "OpenGL version" given the differences between the core and compat profiles, as well as the various GLSL and GLES versions:

glxinfo | grep 'version' server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Max core profile version: 4.1 Max compat profile version: 3.0 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.1.2 OpenGL core profile shading language version string: 4.10 OpenGL version string: 3.0 Mesa 11.1.2 OpenGL shading language version string: 1.30 OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.1.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00 

Notice that the actual version is presented by the "core profile version" (4.1), whereas the "OpenGL version" is presented as 3.0.

depending on what you're looking for:

Open GL Implementation

You can use glxinfo, from the mesa-utils package:

sudo apt-get install mesa-utils glxinfo | grep "OpenGL version" 

Development Libraries

will tell you version information, etc. of any package.

but you'll need to know what specific part/implementation, etc. of opengl you're interested in. i suspect, for you, it'll be:

Note: I've added this answer at a later date, because none of the existing answers address a crucial aspects regarding ssh, and will give misleading values to those who follow the above instructions.

    Use X-forwarding when ssh-ing. This is enabled with ssh -X . Without x-forwarding:

$ ssh MYCOMP $ glxinfo Error: unable to open display 
$ ssh -X MYCOMP $ glxinfo | grep -i opengl OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 8800 GT/PCIe/SSE2 OpenGL version string: 2.1.2 NVIDIA 310.44 OpenGL shading language version string: 1.20 NVIDIA via Cg compiler OpenGL extensions: 
$ ssh -X MYCOMP $ DISPLAY=:0 $ glxinfo | grep -i opengl OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce GTX 550 Ti/PCIe/SSE2 OpenGL version string: 4.3.0 NVIDIA 310.14 OpenGL shading language version string: 4.30 NVIDIA via Cg compiler OpenGL extensions: 

Источник

How do I know which version of OpenGL I am using?

I started writing programs, in C (for now) using GLFW and OpenGL. The question I have is that, how do I know which version of OpenGL my program will use? My laptop says that my video card has OpenGL 3.3. Typing "glxinfo | grep -i opengl" returns:

OpenGL vendor string: NVIDIA Corporation OpenGL renderer string: GeForce 9600M GT/PCI/SSE2 OpenGL version string: 3.3.0 NVIDIA 285.05.09 OpenGL shading language version string: 3.30 NVIDIA via Cg compiler OpenGL extensions: 

So have you figured out the solution yourself and forgot about your question or do you still have some unclarities? In the former case just abandoning a question is extremely bad practice and in the latter case feel free to ask any further questions about existing answers or even post your own answer if different from the already existing ones.

If you want to check GLEW version on Linux from terminal, you can install glew-utils and run visualinfo | grep "OpenGL version" .

1 Answer 1

Just call glGetString(GL_VERSION) (once the context is initialized, of course) and put out the result (which is actually the same that glxinfo does, I suppose):

printf("%s\n", glGetString(GL_VERSION)); 

Your program should automatically use the highest possible version your hardware and driver support, which in your case seems to be 3.3. But for creating a core-profile context for OpenGL 3+ (one where deprecated functionality has been completely removed) you have to take special measures. But since version 2.7 GLFW has means for doing this, using the glfwOpenWindowHint function. But if you don't want to explicitly disallow deprecated functionality, you can just use the context given to you by the default context creation functions of GLFW, which will as said support the highest possible version for your hardware and drivers.

But also keep in mind that for using OpenGL functionality higher than version 1.1 you need to retrieve the corresponding function pointers or use a library that handles this for you, like GLEW.

Источник

How to Check OpenGL version?

how-to-check-opengl-version

LinuxStoney

Today we learn How to Check OpenGL version? OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

How To Check OpenGL Version,

glxinfo | grep "OpenGL version"

You will get the output as follows,

glxinfo | grep "OpenGL version" OpenGL version string: 1.4 (2.1 Mesa 7.7.1)

You may have better luck with modern OpenGL just grepping for “version” instead of “OpenGL version” given the differences between the core and compat profiles, as well as the various GLSL and GLES versions:

glxinfo | grep 'version' server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Max core profile version: 4.1 Max compat profile version: 3.0 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL core profile version string: 4.1 (Core Profile) Mesa 11.1.2 OpenGL core profile shading language version string: 4.10 OpenGL version string: 3.0 Mesa 11.1.2 OpenGL shading language version string: 1.30 OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.1.2 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

Notice that the actual version is presented by the “core profile version” (4.1), whereas the “OpenGL version” is presented as 3.0.

Источник

Читайте также:  Узнать название сетевого интерфейса linux
Оцените статью
Adblock
detector