0

I get a GL_INVALID_OPERATION error when calling glGenTextures and I have no idea what could be responsible for it.

I am using QtOpenGLWidget to retrieve the context and it looks valid at the time I call glGenTextures() (at least I have one since glGetString(GL_VERSION) and glxGetCurrentContext() both return something which is not crap)

The faulty code is called from the QOpenGLWidget::resizeGL() method. In the QOpenGLWidget::initializeGL() I compile successfully some shader programs and I create / upload data to VAO / VBOs.

So my questions are :

  • What are the common faulty cases of glGenTextures() except not having an OpenGL context at all
  • Can an OpenGL context be invalid or messed up and, in such a case
  • How can I check that my OpenGL context is valid ?

EDIT: Since I strongly believe this is related to the fact my machine has no proper GPU, here is the return of glxinfo.

cmourglia
  • 2,423
  • 1
  • 17
  • 33

2 Answers2

2

I don't think that it is the glGenTextures() call, that causes the error. This call can only throw GL_INVALID_ENUM and GL_INVALID_VALUE. Most likely some other call is wrong and the bind() of the new texture is the invalid call.

Try to localise your offending call with glGetError().

You can check the documentation for possible failures of gl calls here: https://www.opengl.org/sdk/docs/man4/html/glCreateTextures.xhtml

OutOfBound
  • 1,914
  • 14
  • 31
0

Ok found the problem. It appears a shader was silently not compiling properly (hardcoded shader not checked for proper compilation, with incorrect #version) and that was messing up the next OpenGL error check which was the glGenTextures().

cmourglia
  • 2,423
  • 1
  • 17
  • 33