Error message during runtime

hello, I am trying to run the ‘simple.c’ program from the first example in chapter 2 of OpenGL SuperBible 3rd Edition and I am getting this error message:

ben-sanders-powerbook-g4-12:~/OpenGL/SuperBible/simple Ben$ ./simple
2006-01-03 22:34:29.698 simple[411] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow

Of course, to get it to work with the mac, I changed the simple.c file a little:

#include <GLUT/glut.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <AGL/agl.h>

void RenderScene( void )
{
glClear( GL_COLOR_BUFFER_BIT );

glFlush();
}

void SetupRC( void )
{
glClearColor( 0.0f, 0.0f, 1.0f, 1.0f );
}

int main( void )
{
glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB );
glutCreateWindow( “Simple” );
glutDisplayFunc( RenderScene );

SetupRC();

glutMainLoop();
}

Any suggestions would be greatly appreciated.

Thanks,
Ben

When using GLUT, you need to call glutInit() before doing anything.

Until you have changed the includes, and you have respected the extension that are supported by the drivers, I guess GLUT samples doesn’t need any translation, and are directly usable on Mac OS X.

Cyril.

great, thanks. I’ll try that stuff

ok, so the suggestion about glutInit worked except I had to set up main as follows:

int main( int argc, char* argv[] )
{
glutInit( &argc, argv );

just fyi.
thanks again for the help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.