I have a problem with glDrawElements(). It worked with arrays and previous versions of jogl but not with buffers and the current.
I’m reading my data with this:
vertbuff = BufferUtils.newDoubleBuffer(vertices * 3);
intbuff = BufferUtils.newIntBuffer(indices * 3);
for (int i = 0; i < vertices; i++) {
st = new StringTokenizer(br.readLine(), " ");
while (st.hasMoreTokens()) {
vertbuff.put(Double.parseDouble(st.nextToken()));
}
}
for (int i = 0; i < indices; i++) {
st = new StringTokenizer(br.readLine(), " ");
st.nextToken();
while (st.hasMoreTokens()) {
intbuff.put(Integer.parseInt(st.nextToken()));
}
}
The file is structured like this:
vertices:
-1.24479 0.64876801 0.200864
-1.48926 0.64368999 0.227226
indices:
3 0 1 2
3 1 3 4
3 5 6 2
And then I’m trying to draw the elements with:
gl.glColor3f(1.0f, 0.0f, 0.0f);
gl.glVertexPointer(3, GL.GL_DOUBLE, 0, vertbuff);
gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
gl.glDrawElements(GL.GL_TRIANGLES, intbuff.capacity(), GL.GL_UNSIGNED_INT, intbuff);
gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
But I alaway get an error:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x691ba460, pid=3040, tid=3300
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode)
# Problematic frame:
# C [atioglxx.dll+0x1ba460]
It works sometimes, when I reduce the size of the buffers (with less vertices and less indices), but not everytime. I already tried to install new drivers but it did not help.