I met this problem first time, everything has worked fine before today. To my mind, the problem is in the memory management, or something similar.
I compressed all my opengl code in a single class, which i call from the main window loop. Still same error.
public class renderTest
{
public float[] vertices(int x, int y, int z)
{
float vertices[] =
{
//...
};
return vertices;
}
public final int[] indices =
{
//...
};
public Model model;
public renderTest()
{
this.model = loadToVAO(vertices(0, 0, -5), indices);
}
public void render(Model model)
{
glBindVertexArray(model.getVaoID());
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glDrawElements(GL_QUADS, model.getVertexAmount(), GL_UNSIGNED_INT, 0); // <<< FATAL ERROR HERE
glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, 0); // <<< OR HERE
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glBindVertexArray(0);
}
public Model loadToVAO(float[] vertices, int [] indices)
{
int vaoID = create();
bindIndicesBuffer(indices);
storeDataInAttributeList(0, vertices, 3);
//storeDataInAttributeList(1, textureCoords, 2);
unbind();
return new Model(vaoID, indices.length);
}
private int create()
{
int ID = glGenVertexArrays();
glBindVertexArray(ID);
return ID;
}
private void storeDataInAttributeList(int attributeNumber, float[] data, int coordinateSize)
{
int vboID = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, vboID);
FloatBuffer buffer = storeDataInFloatBuffer(data);
glBufferData(GL_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
glVertexAttribPointer(attributeNumber, coordinateSize, GL_FLOAT, false, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
private FloatBuffer storeDataInFloatBuffer(float[] data)
{
FloatBuffer buffer = BufferUtils.createFloatBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
private IntBuffer storeDataInIntBuffer(int[] data)
{
IntBuffer buffer = BufferUtils.createIntBuffer(data.length);
buffer.put(data);
buffer.flip();
return buffer;
}
private void bindIndicesBuffer(int[] indices)
{
int vboID = glGenBuffers();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboID);
IntBuffer buffer = storeDataInIntBuffer(indices);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, buffer, GL_STATIC_DRAW);
}
private void unbind()
{
glBindVertexArray(0);
}
}
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000055cdb5c0, pid=5200, tid=4540
JRE version: Java(TM) SE Runtime Environment (8.0_40-b26) (build 1.8.0_40-b26)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b25 mixed mode windows-amd64 compressed oops)
Problematic frame: C [atio6axx.dll+0x23b5c0]
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
The crash happened outside the Java Virtual Machine in native code. See problematic frame for where to report the bug.