title: Using vertex buffers in jogl, crash when too many triangles
body: <p>I have written a simple application in Java using Jogl which draws a 3d geometry. The camera can be rotated by dragging the mouse. The application works fine, but drawing the geometry with glBegin(GL_TRIANGLE) ... calls ist too slow.</p>
  
  <p>So I started to use vertex buffers. This also works fine until the number of triangles gets larger than 1000000. If that happens, the display driver suddenly crashes and my montior gets dark. Is there a limit of how many triangles fit in the buffer? I hoped to get 1000000 triangles rendered at a reasonable frame rate.</p>
  
  <p>I have no idea on how to debug this problem. The nasty thing is that I have to reboot Windows after each launch, since I have no other way to get my display working again. Could anyone give me some advice?</p>
  
  <p>The vertices, triangles and normals are stored in arrays float[][] m_vertices, int[][] m_triangles, float[][] m_triangleNormals.
  I initialized the buffer with:</p>
  
  <pre><code>        // generate a VBO pointer / handle
          if (m_vboHandle &lt;= 0) {
              int[] vboHandle = new int[1];
              m_gl.glGenBuffers(1, vboHandle, 0);
              m_vboHandle = vboHandle[0];
          }
  
          // interleave vertex / normal data
          FloatBuffer data = Buffers.newDirectFloatBuffer(m_triangles.length * 3*3*2);
          for (int t=0; t&lt;m_triangles.length; t++)
              for (int j=0; j&lt;3; j++) {
                  int v = m_triangles[t][j];
                  data.put(m_vertices[v]);
                  data.put(m_triangleNormals[t]);
              }
          data.rewind();
  
          // transfer data to VBO
          int numBytes = data.capacity() * 4;
          m_gl.glBindBuffer(GL.GL_ARRAY_BUFFER, m_vboHandle);
          m_gl.glBufferData(GL.GL_ARRAY_BUFFER, numBytes, data, GL.GL_STATIC_DRAW);
          m_gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
  </code></pre>
  
  <p>Then, the scene gets rendered with:</p>
  
  <pre><code>        gl.glBindBuffer(GL.GL_ARRAY_BUFFER, m_vboHandle);
          gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
          gl.glEnableClientState(GL2.GL_NORMAL_ARRAY);
          gl.glVertexPointer(3, GL.GL_FLOAT, 6*4, 0);
          gl.glNormalPointer(GL.GL_FLOAT, 6*4, 3*4);
          gl.glDrawArrays(GL.GL_TRIANGLES, 0, 3*m_triangles.length);
          gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
          gl.glDisableClientState(GL2.GL_NORMAL_ARRAY);
          gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
  </code></pre>