PDA

View Full Version : error message during runtime



BenSanders
01-03-2006, 09:44 PM
hello, I am trying to run the 'simple.c' program from the first example in chapter 2 of OpenGL SuperBible 3rd Edition (http://www.amazon.com/gp/product/0672326019/qid=1136356768/sr=8-1/ref=pd_bbs_1/103-9949499-0167803?n=507846&s=books&v=glance) 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

arekkusu
01-04-2006, 02:21 AM
When using GLUT, you need to call glutInit() before doing anything.

kard
01-04-2006, 07:38 AM
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.

BenSanders
01-04-2006, 10:46 AM
great, thanks. I'll try that stuff

BenSanders
01-09-2006, 12:18 PM
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.