LWJGL Forum

Programming => OpenGL => Topic started by: ste3e on February 11, 2011, 09:32:32

Title: glEnableVertexAttribArray crashes program
Post by: ste3e on February 11, 2011, 09:32:32
I have set up a VBO with sequential data of vertex, coords, normals, tangents and bitangents. The code below runs fine until I add (or uncomment) glEnableVertexAttribArray(0) whereupon the program crashes and files "A fatal error has been detected by the Java runtime environment"... the error occurs outside of the JVM. Are there any known issues, or have I done something wrong in the code below?


int tanLoc=GL20.glGetAttribLocation(Bin.mainShader, "vTan");
        if(tanLoc<1)
            System.out.println("Error setting grabbing shader vars");
       
        ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vboId);
        GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
        GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, coordOff);
        GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
        GL11.glNormalPointer(3, GL11.GL_FLOAT, normOff);
        GL20.glEnableVertexAttribArray(0);


Title: Re: glEnableVertexAttribArray crashes program
Post by: Matzon on February 11, 2011, 09:54:18
technically, crashes outside LWJGL.dll == broken drivers

Have you checked for GL version is 2.0 or greater?
Title: Re: glEnableVertexAttribArray crashes program
Post by: Matthias on February 11, 2011, 09:56:24
If you want help then you should upload the crash report file from hotspot.

Crashes with VBO are most likely driver bugs.
Crashes with VA are most likely application bugs where data outside the vertex array are accessed - eg by passing invalid indices to glDrawElements.
If you use VBOs and VAs in the same application then the most likely cause is that your forgot to enable/disable an array or update it's pointer - see crashes with VA above.