Original Post
I don't get it. Everything was working fine earlier, now the following code fragment won't even work. According to gDEbugger, I get a GL_INVALID_OPERATION on the glVertexAttribPointer() call. But I don't see anything wrong with it.
Note: I'm using the GLFW and GLEW libraries.
The weird thing is, it starts working fine if I change my OpenGL context to 3.1 (instead of 3.2) and backward compatible (instead of forward compatible).
Am I missing something obvious, or has my computer gone crazy?
Note: I'm using the GLFW and GLEW libraries.
struct quadFormat_s
{
float x;
float y;
float z;
float u;
float v;
};
quadFormat_s quadVertex[] = {
{-1.0f, -1.0f, 1.0f, 0.0f, 1.0f},
{-1.0f, 1.0f, 1.0f, 0.0f, 0.0f},
{1.0f, 1.0f, 1.0f, 1.0f, 0.0f},
{1.0f, -1.0f, 1.0f, 1.0f, 1.0f}
};
glfwInit();
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MAJOR, 3 );
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MINOR, 2 );
glfwOpenWindowHint( GLFW_OPENGL_FORWARD_COMPAT, true );
glfwOpenWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
glfwOpenWindow( 1024, 768, 8, 8, 8, 8, 24, 0, GLFW_WINDOW );
glewInit();
glGenBuffers( 1, &vboVertexQuad );
glBindBuffer( GL_ARRAY_BUFFER, vboVertexQuad );
glBufferData( GL_ARRAY_BUFFER, quadVertexCount*sizeof(quadFormat_s), quadVertex, GL_STATIC_DRAW );
glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, sizeof(quadFormat_s), reinterpret_cast<void*>(0 + 0) );
The weird thing is, it starts working fine if I change my OpenGL context to 3.1 (instead of 3.2) and backward compatible (instead of forward compatible).
Am I missing something obvious, or has my computer gone crazy?