VBOs and Vertex Arrays in OpenGL not working

Been working in OpenGL for a few weeks now and have gotten into some of the slightly more advanced aspects such as Vertex Arrays and Vertex Buffer Objects.

I found a few tutorials that explained how things work and what needs to be done to get these to work, but every time I attempt to use VBOs and VAs, my code explodes with the error: EXC_BAD_ACCESS and the debugger says it stops at a function known as gleLLVMLoadDataFromAryFloatInFloat.

I gave up on getting VBOs to work after getting this error several times; I figured that my video card did not support VBOs.

But then I read some info on VAs and found that they should be supported as long as glext.h was available to you. Inside of opengl.h is glext.h. Besides, my compiler has no issue with the code I have written, but it continues to crash with the above errors, even with Vertex Arrays. Here is my code:

/** Draws a cube, with faces built for alpha blending (counter-clockwise)
*
* @parameter angle The angle at which to draw the cube.
*/
void drawCube(float angle)
{
glPushMatrix(); //Save the current render context.

/** Draws the floor quad with alpha reduction. */
void drawFloor()
{
/** Reflections using colored (non-textured) polygons require the use of
* the Color4f call to specify a color AND transparency for that vertex.
* OpenGL will interpolate alpha values between points with different alpha
* values, allowing for some cool gradient effects.
**/

When you are crashing using vertex arrays or VBOs, there is a 99.9% chance that your app has a bug. Here is what you should look for:

1) you've got a valid pointer set for all of the attributes you're submitting (a pointer to client address, if using VAs, or a valid offset, if using VBOs)
2) you've got all of the attributes you're submitting enabled, and don't have any other attributes enabled.
3) if you're using VBOs, you had a BO bound at the time you set each pointer as an offset, and not bound for pointers you set as a client address.

Failing any of those three things results in GL trying to read from memory that you don't own, or the GL didn't allocate for you, and you crash.

The other 0.01% of the time, it's a driver bug.

In the code you posted, you've enabled VERTEX, COLOR, and NORMAL. But you've only ever set the pointers for Vertex. So the GL may try to load color and normal data from the default null pointer, and crash.

You were correct in the fact that removing GL_COLOR_ARRAY and GL_NORMAL_ARRAY allowed it to run just fine...

Until I tried back face and front face culling with it. With the new code, it doesn't even draw the cube. Any draw that uses either of the VAs does not draw. Compiler works fine, it doesn't crash anymore... I don't know what to think.

BTW I reenabled GL_COLOR_ARRAY and it seems to work OK now.

[EDIT]
Nevermind! I fixed it! I still had calls to my generateCubeVBO() function which was disrupting my settings! Thanks still.

[Second Edit]
I also found that normals are declared PER VERTEX in VA usage, so that is probably why I was getting errors when trying to associate normals with my vertexes. Should have guessed...

[Final Edit]
Well, I can't get a glNormalPointer(3, GL_FLOAT, cubeNormals) call to not crash. It gives me my original crash and message. Any new insight?

Mac users swear by their computers, PC users swear at their computers. ~Unknown