You cannot avoid the minimum amount of objective-C code. However, if you rename C object files to .mm files, C object code will be able to call C ++ class methods. This means that you can connect -drawRect (and other relevant NSOpenGLView posts) to the C ++ OpenGL implementation. NSOpenGLView has a -makeCurrent method, which you can call outside of drawRect to make sure that the correct OpenGL context is active.
Then your C ++ code can simply call the gl functions as needed.
source
share