LWJGL GL_INVALID_ENUM reason

I’m having a problem with [icode]org.lwjgl.opengl.GL11.glDrawElements(int mode, int count, int type, long indicesOffset)[/icode].

According to the documentation of OpenGL it gives a GL_INVALID_ENUM if the mode variable is not correct. But I’m sure the variable is correct:


		int err;
		while((err = GL11.glGetError()) != GL11.GL_NO_ERROR) {
			System.out.println("2.1:" + err);
		}
		glDrawElements(GL11.GL_TRIANGLES, ebo.getCapacity(), ebo.getType().glType,
				offset);
		while((err = GL11.glGetError()) != GL11.GL_NO_ERROR) {
			System.out.println("2.2:" + err);
		}

The output of the console: [icode]2.2:1280[/icode] which is GL_INVALID_ENUM

Did I miss something important in the documentation?

Just to be thorough, have you checked that glType is valid? The documentation doesn’t mention this as a possible source of ‘invalid enum’ errors (and I’d be surprised if the documentation was incomplete or inaccurate), but in the interest of narrowing things down, it might be worth double-checking.

You are right, the value is wrong :persecutioncomplex:
The value of glType is 5122, which stands for GL_SHORT.
But it only accepts GL_UNSIGNED_SHORT for short variables.
Changing it to GL_UNSIGNED_SHORT crashed the JVM tho ???

I’m investigating the JVM crash now. Will keep the topic updated :point:

JVM crash means you’re telling the driver to read from somewhere it’s not allowed to. Check your VBOs and IBOs, make sure everything is bound and you’re not making it read out of bounds.