glCreateShader fails on osx 10.8.2

Using GLFW
2013-03-27
2013-03-27
  • kengo nakajima
    kengo nakajima
    2013-03-27

    On 3.0head, (github 4c0e946da3bbc7c24062984467b419cbd8ed0c30)
    glCreateShader returns always 0 (fail) on OSX 10.8.2.
    on 2.7.7, it succeeds.

    You can reproduce this issue by adding some lines in examples/boing.c main() as follows:

    int main( void )                                                                                                    
    {                                                                                                                   
       GLFWwindow* window;                                                                                              
       int width, height;                                                                                               
    
       /* Init GLFW */                                                                                                  
       if( !glfwInit() )                                                                                                
          exit( EXIT_FAILURE );                                                                                         
    
       glfwWindowHint(GLFW_DEPTH_BITS, 16);                                                                             
    
       window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );                                 
       if (!window)                                                                                                     
       {                                                                                                                
           glfwTerminate();                                                                                             
           exit( EXIT_FAILURE );                                                                                        
       }                                                                                                                
    
       GLuint n = glCreateShader( GL_FRAGMENT_SHADER );     // this always fails
       assert( n > 0 );  
       // ...
    

    In 2.7.7, this successes:

    int main( void )                                                                                                    
    {                                                                                                                   
       int running;                                                                                                     
    
       /* Init GLFW */                                                                                                  
       if( !glfwInit() )                                                                                                
       {                                                                                                                
          fprintf( stderr, "Failed to initialize GLFW\n" );                                                             
          exit( EXIT_FAILURE );                                                                                         
       }                                                                                                                
    
       if( !glfwOpenWindow( 400,400, 0,0,0,0, 16,0, GLFW_WINDOW ) )                                                     
       {                                                                                                                
           fprintf( stderr, "Failed to open GLFW window\n" );                                                           
           glfwTerminate();                                                                                             
           exit( EXIT_FAILURE );                                                                                        
       }                                                                                                                
    
       GLuint n = glCreateShader( GL_FRAGMENT_SHADER ); // succeed here                                                                 
       assert( n > 0 );
    

    How to fix this?