cmourglia
cmourglia

Reputation: 2534

glGenTextures gives GL_INVALID_OPERATION despite valid OpenGL context

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 :

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

Upvotes: 0

Views: 1586

Answers (2)

cmourglia
cmourglia

Reputation: 2534

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().

Upvotes: 0

OutOfBound
OutOfBound

Reputation: 2014

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

Upvotes: 2

Related Questions