Reputation: 23
I'm trying to learn OpenGL on OSX Mavericks which supports upto OpenGL 4.1 as of today.
I'm keeping it basic and compiling using gcc (g++), but when loading the open GL context through Freeglut OSX loads the legacy OpenGL profile.
I've tried this: OpenGL 3.3 on OSX with FreeGLUT but with no luck, a glGetString call returns these values:
NVIDIA GeForce GT 750M OpenGL Engine
2.1 NVIDIA-8.24.9 310.40.25f01
Anyone have any ideas?
i'm calling FreeGlut with the following context calls:
glutInitContextVersion(3,2);
glutInitContextProfile(GLUT_CORE_PROFILE);
Edit: Just tried the same application in Windows rather than OSX and got this error:
2.1 context requested but wglCreateContextAttribsARB is not available. Falling back to legacy context creation
Here is my application entry point
int main (int argc, char * argv[])
{
try{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(512,512);
glutInitContextVersion(4,2);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
glutInitContextProfile(GLUT_CORE_PROFILE);
cout << "Called GLUT with 'GLUT_FORWARD_COMPATIBLE' \n";
//cout << VAO_IDs::NumVAOs;
glutCreateWindow("Triangles!");
cout << "Calling GLEW. " << endl;
glewExperimental = GL_TRUE;
if(glewInit())
{
cerr << "unable to initialise GLEW.. Exiting " << endl;
}
cout << "calling init " << endl;
init();
cout << "Setting display function " << endl;
glutDisplayFunc(display);
cout << "Entering loop " << endl;
glutMainLoop();
}
catch (exception)
{
cerr << "ERROR! " <<endl;
}
}
OK So...
Recompiled on a Windows PC, worked no issue, maybe an issue with FreeGLUT on OSX or OSX itself or a combination.
At least now I have code I can test OSX with...
Upvotes: 2
Views: 1721
Reputation: 25396
OSX Mavericks
has no support of OpenGL 4.2
. Hence, it is impossible to create a 4.2 context. The last supported version is 4.1
+ some extensions which are made into Core in 4.2
.
If you want to ship today the only option is using OpenGL 4.1
with extensions.
Here is the code for GLFW3
:
glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 4 );
glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 1 );
glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE );
glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
Upvotes: 5