Glfw: Failed to create window in core profile mode

Created on 23 Jul 2016  路  4Comments  路  Source: glfw/glfw

System: OS X 10.11.5; Intel HD Graphics 3000 384 MB
GLFW: 3.1.2 (from brew repo)
I'm trying to run OpenGL application. As described here core's OpenGL Version for my OS and video card is 3.3. My code:

glfwInit();
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 3 );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );

if( !glfwCreateWindow( 600, 400, "Window", nullptr, nullptr ) ) {
    printf( "error: Failed to create window\n" );
    exit( 1 );
}

I get fail after if statement. What is wrong?

macOS support

Most helpful comment

You forgot to set the forward compatible bit to true, which is also necessary.

glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

As others have said, error checking is also important to do.

See this entry in the FAQ:

4.1 - How do I create an OpenGL 3.0+ context?

All 4 comments

You should try setting an error callback; glfw will usually report what went wrong.

Also, did you try checking if glfwInit() returns GLFW_FALSE ?

You forgot to set the forward compatible bit to true, which is also necessary.

glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

As others have said, error checking is also important to do.

See this entry in the FAQ:

4.1 - How do I create an OpenGL 3.0+ context?

@shurcooL thanks, you're right

Was this page helpful?
0 / 5 - 0 ratings

Related issues

opengl-tutorial picture opengl-tutorial  路  3Comments

floooh picture floooh  路  5Comments

elmindreda picture elmindreda  路  4Comments

GraemeWilde picture GraemeWilde  路  3Comments

dmitshur picture dmitshur  路  4Comments