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?
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:
@shurcooL thanks, you're right
Most helpful comment
You forgot to set the forward compatible bit to true, which is also necessary.
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?