What's the best way to use OpenGL with Cocoa?
I've been trying to create a Cocoa project that uses OpenGL. NSOpenGLView
is too restrictive for my needs, so I've created my own custom NSView
subclass. I need to have multiple copies of this class on screen at once. And I need to use shaders.
What's the best way to organize this sort of project? I've tried a ton of different setups, but I always seem to wind up having invalid drawables, GL errors, trouble managing contexts, et开发者_C百科c. Is there a simple way that I'm overlooking? Maybe setting up a single context at app launch and having all views share it?
Stay away from messing with OpenGL yourself...it sucks. Just say no.
I HIGHLY recommend using Cocos2D. Its a FANTASTIC graphics library that is highly supported and documented and handles all the OpenGL nonsense and makes the pain go away. Don't touch OpenGL unless you want to spend more time dinking with technical details than actually making your project happen.
精彩评论