Access Violation when trying to bind Vertex Object Array

Posted by Paul on Game Development See other posts from Game Development or by Paul
Published on 2012-12-18T17:08:44Z Indexed on 2012/12/18 17:15 UTC
Read the original article Hit count: 326

Filed under:
|

I've just started digging into OpenGL and I've run into a problem trying to set a VOA.

It's giving me a run-time error of :

An unhandled exception of type 'System.AccessViolationException'

At

    // Create and bind a VAO
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);

I have searched the internet high and low for a solution and I haven't found one. The rest of my function looks like this:

int main(array<System::String ^> ^args)

{

// Initialise GLFW
if( !glfwInit() )
{
    fprintf( stderr, "Failed to initialize GLFW\n" );
    return -1;
}

glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 0); // 4x antialiasing
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL

// Open a window and create its OpenGL context
if( !glfwOpenWindow( 800, 600, 0,0,0,0, 32,0, GLFW_WINDOW ) )
{
    fprintf( stderr, "Failed to open GLFW window\n" );
    glfwTerminate();
    return -1;
}


// Initialize GLEW
if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initialize GLEW\n");
    return -1;
}

glfwSetWindowTitle( "Game Engine" );


// Create and bind a VAO
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);

glfwEnable( GLFW_STICKY_KEYS );

© Game Development or respective owner

Related posts about c++

Related posts about opengl