2

I'm trying to get a very basic openGL application up and running. I have a GTX 770, and i've installed nvidia-361 drivers. when i run glxinfo | grep version, i get:

OpenGL core profile version string: 4.5.0 NVIDIA 361.42

OpenGL core profile shading language version string: 4.5.0 NVIDIA

OpenGL version string: 4.5.0 NVIDIA

this would lead one to believe that your drivers supported OpenGL 4.5, right?

now, i'm using GLEW in my basic application. i get the version string and print it:

const GLubyte* version = glGetString(GL_VERSION); printf("version: %s\n", version); 

and when i run the program, i get:

version: 3.2.0 NVIDIA 361.42

?????????????????????????

what's happening here? i checked my version of libglew-dev, and it's 1.13.0. OpenGL 4.5 support was added in 1.11.0. so i don't think GLEW is the problem, but i can't figure out what's going on.

1 Answer 1

6

glGetString(GL_VERSION) returns the version the current GL context is providing, not necessarily the highest version your GL implementation is supporting.

GLEW has nothing to do with that, it just loads GL function pointers. Relevant is the way you created the context. What you see here is the normal behavior of the nvidia driver in recent versions: when you ask it for some GL x.y context, it does return version x.y, and not a higher version it would still support.

If you want a 4.5 context, just request a GL 4.5 context. How to do that depends on the way you create the context. If you use some libraries like GLFW, GLUT, SDL, Qt, ..., just consult the documentation on how to request a specific context version. If you manually create the context via glX, use glXCreateContextAttribsARB with proper GLX_CONTEXT_MAJOR_VERSION_ARB and GLX_CONTEXT_MINOR_VERSION_ARB attributes.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.