Enum error on element binding (using one big JAR)

Started by lunchbox, August 03, 2011, 14:01:01

Previous topic - Next topic

lunchbox

Hi all,

I've been working on a game project with some friends for a while now and I've been asked by a few people to provide a copy for testing purposes. I was asked to just pack the whole thing in a JAR file. Using http://www.jdotsoft.com/JarClassLoader.php I packed the whole project into a single jar resources/natives/libs (I've heard this may be a bad idea; if someone has a thought on that please feel free to chime in.) This seemed like it was going to work fine, but now I have a very odd error at a strange point in the code:
      ARBVertexBufferObject.glBindBufferARB(
         ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, modelVBOID);

      ARBVertexBufferObject.glBindBufferARB(
         ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, modelVBOindexID);

I'm getting an invalid enum error:
org.lwjgl.opengl.OpenGLException: Invalid enum (1280)
   at org.lwjgl.opengl.Util.checkGLError(Util.java:59)
   at org.lwjgl.opengl.ARBBufferObject.glBindBufferARB(ARBBufferObject.java:46)
   at engine.render.Model.draw_vbo(Model.java:368)

This is part of my vbo drawing code on the ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB line. So it seems to be totally cool with the GL_ARRAY_BUFFER_ARB enum, but not the element one? This code works perfectly when not packed into the jar so I'm really confused as to what could be happening. If anyone has thoughts on how to debug this let me know.

Thanks

kappa

Odd that it should fail at such a point when put in a jar. You could also try the JarSplice tool which does the same thing, see if you get the same error when using that.

Morre

Hi,

I can't say I know much about this (haven't used plain LWJGL for years), but Evil saw the thread via the LWJGL irc channel and asked somebody to post a reply, so I'll quote him:

Quote
Evil[1]: oh my... can someone answer this thing on the forum? instead of GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB to use GL_ELEMENT_ARRAY_BUFFER_ARB...
Evil[1]: *_BINDING_* is for glGet[Boolean/Float/Int]

I hope it helps.

EDIT: oO, I can't believe this is my first post here. I've had an account since forever. Oh well :)

lunchbox

Ah, that's definitely the problem. I'm shocked that it has been working all this time (and more shocked that putting it in a JAR file brought it to my attention.) Turns out that I was using the non-VBO glDrawRangeElements which was basically drawing a VAO instead and avoiding the error that would have normally occured at the glDrawRangeElements function when it was set up to draw with indices: org.lwjgl.opengl.OpenGLException: Cannot use Buffers when Element Array Buffer Object is enabled

Quite the mess, but I'm glad to have found out this was happening. Thanks everyone!