Search code examples
macosopenglterminalosx-mountain-lionglfw

Setting up OpenGL and GLFW on Mac OS X 10.8.2


I am having an issue setting up GLFW / OpenGL on Mac. I am running a fully updated Mac OSX 10.8.2, so I am assuming that I have the most up to date mac-compatible OpenGL version and I have compiled the GLFW libraries (2.7.7) using homebrew (OS X package manager).

I am trying to use the following guide, open.gl , and am using the recommended code snippet to verify OpenGL and GLFW are working properly:

\#include <GL/glfw.h>

int main()
{
  glfwInit();
  glfwSleep( 1.0 );
  glfwTerminate();
}

This should show a console application and exit after a second.

I am compiling with g++ in terminal and receiving no compile errors:

g++ a.cpp -lglfw -framework OpenGL -framework Cocoa -framework IOkit

When I run the program with

 ./a.out 

nothing happens, but I do get the 1 second delay before it closes, so I know that much is working.

Let me know if there is any further information that might be helpful.


Solution

  • You have no GL context or window - just a command line application running on a terminal.

    Refer to the glfwOpenWindow documentation.