I have the following code:
glfwWindowHint(GLFW_SAMPLES, 4); // 4x antialiasing
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Open window and create OpenGL context
GLFWwindow * window;
window = glfwCreateWindow(1024, 768, "OpenGL Testing", NULL, NULL);
if(window == NULL)
{
fprintf(stderr, "Failed to open GLFW Window.\n");
glfwTerminate();
return -1;
}
It works fine on my desktop on both Ubuntu and Windows, but it fails on my laptop running OSX. I thought it was an issue with the laptop not supporting this version of OpenGL, but it supports up to 4.1 with the video card.
I have thought that it may be using the integrated intel GPU instead of the nVidia one, but as I understand from what I have seen, GLFW will force the correct GPU to do the rendering.
If I change the context to 2.1, everything seems to work, but then the shaders aren't compatible.
Any ideas?
UPDATE: If all of the glfwWindowHint()
calls are removed, the window is created, but the shaders are incompatible. I assume if these are removed, GLFW automatically chooses a context, which happens to be incompatible with shaders with version 330 core
.