Assuming you got the window creation code right, you may be thinking everything is going to work, but you get this error:
Sun Jan 10 20:27:54 macbook-pro.local cocoatest[55526]
Sun Jan 10 20:27:54 macbook-pro.local cocoatest[55526]
Sun Jan 10 20:27:54 macbook-pro.local cocoatest[55526]
Sun Jan 10 20:27:54 macbook-pro.local cocoatest[55526]
2010-01-10 20:27:54.787 cocoatest[55526:a0f] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
This means your NSApplication is not being initialized. In other words, the Objective-C side of your system needs to be properly initialized. Adding the following line may help:
[NSApplication sharedApplication];
Refer to the Apple documentation of NSApplication for more help.
Soon, I will post the complete code that creates an OpenGL Cocoa window from a C++ application without a NIB (as soon as I figure it out).
4 comments:
Hi, I met the same problem when I compile my C++ ogl code. I look forward seeing your solutions. Thanks.
Hi, I met the same problem when I compile my C++ ogl code. I look forward seeing your solutions. Thanks.
Update:
I get the same errors even when I run this code in the Xcode IDE. Do you know what's wrong?
My email is sny1985@gmail.com
just run glutInit(&argc, argv); before any initialization code in the main function, worked for me.
I needed a solution that doesn't depend on GLUT.
Post a Comment