Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to know the version of Opengl API that I'm using and I'm using this code:

import OpenGL.GL as gl
# Obtenemos la versión de OpenGL API
version = gl.glGetString(gl.GL_VERSION)
print(version)

And I have this error:

OpenGL.error.GLError: GLError(
        err = 1282,
        description = b'operaci\xf3n no v\xe1lida',
        baseOperation = glGetString,
        cArguments = (GL_VERSION,)

What do I have to do to solve it?

You need an OpenGL context to call an OpenGL API function. Usually, the OpenGL context is created along with the OpenGL window. Therefore, you must create the window before you can call gl.glGetString. – Rabbid76 Dec 28, 2022 at 17:58

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.