PDA

View Full Version : Why can't I run the programs from the book OpenGL Superbible Third Edition?



ShowaSanke95
08-31-2012, 12:26 PM
Here is the program from the book OpenGL SuperBible, I have been stuck on it for the past week. I am compiling on a Mac OS X Lion with Xcode 4. I am using the OpenGL and GLUT libraries. Here is the runtime error I am receiving and the sample code. Thanks for all the help, sorry, I'm still a beginner.

#include <OpenGL/gl.h>
#include <GLUT/glut.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();

return (0);
}

//copied from OpenGL SUPERBBIBLE third edition
//end of code

here is the runtime error I get


Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection
2012-08-31 15:04:42.934 OpenGL Test[771:603] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow on line 263



I took out my name, what am i doing wrong and why can't I run any of the examples in this book? Thanks for the help.

dylanmc
11-08-2012, 02:44 PM
On MacOS X 10.7, I'm trying to build a program that uses SDL as its wrapper for OpenGL, and got the same error:



Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
Aug 31 15:04:42 ****-pc.home OpenGL Test[771] <Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection
2012-08-31 15:04:42.934 OpenGL Test[771:603] GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow on line 263


and Googling brought me to this thread, so I tried copy/pasting in the code posted above, and got exactly the same error again. So whatever problem this example code has, seems to be present in the MacOS port of libSDL. It would be great to figure it out and help the SDL folks fix this problem.

I compiled my example program with the following command:


gcc -o test test.c -framework OpenGL -framework GLUT

My exact error message (to help other Googlers find this thread) is:


<Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
<Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
<Error>: kCGErrorInvalidConnection: CGSGetCurrentCursorLocation: Invalid connection
<Error>: kCGErrorInvalidConnection: CGSNewWindowWithOpaqueShape: Invalid connection
GLUT Fatal Error: internal error: NSInternalInconsistencyException, reason: Error (1002) creating CGSWindow on line 263


It would be great to figure out why CGSWindows are returning NSInternalInconsistencyException.