Ok, so as many (if not all of you know), I'm having an absolutely wonderful time with my vertex buffer objects (sarcasm). So in attempting to find out why things are blowing up on me, I thought I'd check to make sure that everything involved with the VBOs are set up properly.
Well, after a few hours of checking this and that, I thought "hey, take the VBO out and see if everything works client side." So, I set the condition to use the VBO or not to false and just used a regular VA with glDrawRangeElements and it started crashing too. That really got me wondering what was going on. So, I cut it down to just a single call to glDrawElements and as it's still crashing, I'm thinking there has to be something wrong.
Here's what I'm left with:
glNormalPointer(GL_FLOAT, sizeof(*vertList), &vertList[0].norm);
glVertexPointer(3, GL_FLOAT, sizeof(*vertList), &vertList[0].vert);
glDrawElements(GL_TRIANGLES, numInd, GL_UNSIGNED_INT, index);
When the program is run, the value of numInd is 36, and index contains the following:
0
1
2
1
3
2
4
5
6
5
7
6
17
23
14
24
20
15
11
29
18
30
25
19
8
26
12
27
31
13
16
21
9
22
28
10
That's 36, perfectly valid indices, ranging from 0 to 31 (and there just so happens to be 32 elements to vertList). Index array is a list of unsigned int and I give it enough space for 3 * the size of an unsigned int * the number of faces there are. vertList contains 32 valid vectors and normals (I had both output to a file and checked it). I've also remembered to enable both GL_NORMAL_ARRAY and GL_VERTEX_ARRAY.
So! Am I crazy or shouldn't at least this work? Or both? Upon execution, I get the following error:
Unhandled exception at 0x04e462aa in project3.exe: 0xC0000005: Access violation reading location 0x09b8abe0.
Can anybody see what's going on here? I'm happy to provide more info if it will help.
Without order nothing can exist - without chaos nothing can evolve.