[FIXED] I think I'm doing something wrong with VBOs

I just started doing some development with JOGL. I am fairly experienced with OpenGL, but this is my first time using JOGL.

I can run the WebStart VBO demo, so I’m confident that my environment is not the issue.

I am trying to create multiple rendering paths for a game engine, but I’m stuck on my VBO implementation. The JVM exception is being thrown when I try to call glDrawElements, but I’m not sure if it’s a setup error, or an error when I try to draw. All of my code is Scala, so instead of posting the code, I’ll post the DebugGL2 output (which is a fantastic feature by the way).

Creating my Vertex Array VBO. There is some logic in here to make sure my buffer got copied correctly to video memory (The line between glMapBuffer and glUnMappBuffer is a check to make sure all of the data is the same after I copy it over)


glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8892, <int> 0x1)
glBufferData(<int> 0x8892, <int> 0xC0, <java.nio.Buffer> java.nio.DirectFloatBufferU[pos=0 lim=48 cap=48], <int> 0x88E0)
glMapBuffer(<int> 0x8892, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=192 cap=192]
Float Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)(16,true)(17,true)(18,true)(19,true)(20,true)(21,true)(22,true)(23,true)(24,true)(25,true)(26,true)(27,true)(28,true)(29,true)(30,true)(31,true)(32,true)(33,true)(34,true)(35,true)(36,true)(37,true)(38,true)(39,true)(40,true)(41,true)(42,true)(43,true)(44,true)(45,true)(46,true)(47,true)
glUnmapBuffer(<int> 0x8892) = true

Creating my Color Array VBO. This is the same exact logic as when I create the Vertex Array VBO


glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8892, <int> 0x2)
glBufferData(<int> 0x8892, <int> 0xC0, <java.nio.Buffer> java.nio.DirectFloatBufferU[pos=0 lim=48 cap=48], <int> 0x88E0)
glMapBuffer(<int> 0x8892, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=192 cap=192]
Float Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)(16,true)(17,true)(18,true)(19,true)(20,true)(21,true)(22,true)(23,true)(24,true)(25,true)(26,true)(27,true)(28,true)(29,true)(30,true)(31,true)(32,true)(33,true)(34,true)(35,true)(36,true)(37,true)(38,true)(39,true)(40,true)(41,true)(42,true)(43,true)(44,true)(45,true)(46,true)(47,true)
glUnmapBuffer(<int> 0x8892) = true

Creating the VBO for my face indices.


glGenBuffers(<int> 0x1, <[I>, <int> 0x0)
glBindBuffer(<int> 0x8893, <int> 0x3)
glBufferData(<int> 0x8893, <int> 0x40, <java.nio.Buffer> java.nio.DirectIntBufferU[pos=0 lim=16 cap=16], <int> 0x88E0)
glMapBuffer(<int> 0x8893, <int> 0x88B8) = java.nio.DirectByteBuffer[pos=0 lim=64 cap=64]
Int Buffer data: (0,true)(1,true)(2,true)(3,true)(4,true)(5,true)(6,true)(7,true)(8,true)(9,true)(10,true)(11,true)(12,true)(13,true)(14,true)(15,true)
glUnmapBuffer(<int> 0x8893) = true

Disabling VBOs


glBindBuffer(<int> 0x8892, <int> 0x0)
glBindBuffer(<int> 0x8893, <int> 0x0)

Rendering


glBindBuffer(<int> 0x8892, <int> 0x1)
glEnableClientState(<int> 0x8074)
glVertexPointer(<int> 0x3, <int> 0x1406, <int> 0x0, <long> 0)
glBindBuffer(<int> 0x8892, <int> 0x2)
glEnableClientState(<int> 0x8076)
glVertexPointer(<int> 0x3, <int> 0x1406, <int> 0x0, <long> 0)
glBindBuffer(<int> 0x8893, <int> 0x3)
glDrawElements(<int> 0x0, <int> 0x10, <int> 0x1405, <long> 0)

The error occurs in the glDrawElements method, and it is a JVM error.


# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x2c74fee9, pid=3352, tid=548
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C  0x2c74fee9
#
# An error report file with more information is saved as:
# C:\projects\scala\game\reborn\client\hs_err_pid3352.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

JOGL 2.0 beta 10
OS: Windows XP
GFX Card: Geforce 6600GT with latest drivers
JRE: 1.6

Any help would be greatly appreciated.

Just found the bug. Instead of calling glColorPointer to set up my color buffer for drawing, I was calling glVertexPointer again.

Everything seems to be working fine now.