Use the OpenGL library GLFW the latest version is 3.0.4...
right after you initialize glfw init
if (!glfwInit())
{
printf("glfwInit() fail to initualize. \n");
glfwTerminate();
exit(-1);
}
after you initialize glfwInit() include these 4 lines of code. these four line of code will enable you to use the highest version supported by you OS. on mac its opengl 4.1
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
then create your window.
_Window = glfwCreateWindow(width, height, title, 0, 0);
check to make sure it was created.
if (!_Window) {
printf("Display window fail to create. \n");
glfwTerminate();
exit(-1);
}
then make it you current window using the following.
glfwMakeContextCurrent(_Window);
after you make it your cureent window all thats left to be done is to create you main loop.
while (!glfwWindowShouldClose(_Window))
{
........
glfwSwapBuffers(_Window);
glfwPollEvents();
}
make sure you includ glfwPollEvents(); in the loop this makes it possible to use the close botton to quit the window. if you having trouble compiling the library in xcode just message me on here and i will send you a copy of the library.