GLEW can't find GL version

314 views Asked by At

According to the error output GLEW cannot find the GL version. I'm running the latest Nvidia drivers for my 660s.

Here's the interesting bits of my code:

glewExperimental = GL_TRUE;
GLenum glewErr = glewInit();

if(glewErr != GLEW_OK) {
    std::cerr << "Couldn't init GLEW" << std::endl;
    std::cerr << glewGetErrorString(glewErr) << std::endl;
}

// Create main window
GLWindow mainWindow(800, 600, "OpenGL");

//Test GLEW
GLuint vertexBuffer;
glGenBuffers(1, &vertexBuffer);
std::cout << vertexBuffer << std::endl;

The program crashes at the GLEW test. Console says it can't find the GL version. Rest of the code is here

1

There are 1 answers

0
Brady Dean On BEST ANSWER

As jozxyqk said, I had to create a GL context before I initialized GLEW.