glDrawArrays VM Crash

I am using LWJGL 3. I am working on replacing all the deprecated GL code I was using with the modern stuff. Shaders and the like.

So I am getting this VM crash when I call glDrawArrays: http://www.java-gaming.org/?action=pastebin&id=1403

As far as I can tell, there is no GL error from glGetError.

Here is the actual call to glDrawArrays: https://github.com/sci4me/SciCraft/blob/sgl/src/main/java/com/sci/craft/client/render/renderer/RenderSkybox.java#L87

I’ll keep looking, but so far I haven’t really found much. The one hint I found was relating to VAOs. Could they be related to this?

The bug is exactly here. :slight_smile:
The first argument to that method call should be 1.

You did not specify the vertex pointer for attribute index 1, so you ended up with asking OpenGL to source from an unspecified VBO/buffer for the enabled attribute index 1.

Doh! I’m such an idiot.
Thanks a lot!

EDIT: With the way I’m doing things, do I have to do the glVertexAttribPointer calls every frame or just on init?

OpenGL is a very big state machine that will keep its current state unless you explicitly change it with API calls. So once you call glVertexPointer when some buffer happens to be bound to GL_ARRAY_BUFFER at that time, this setup will stay forever unless you call that function again with some other buffer bound to GL_ARRAY_BUFFER, or by changing the whole vertex specification and attribute enable state with VAOs and their glBindVertexArray. But you don’t seem to be using VAOs.