我在使用glfw+CoreGraphics进行测试,绘制流程是像OpenGL一样 draw, flush, waitEvents, OpenGL绘制完使用SwapBuffers就可以刷新到屏幕了,使用CGContext时却无法生效。
大致代码如下
CGContextRef ctx = [[nsWindow graphicsContext] CGContext];
[[nsWindow contentView] lockFocus];
// draw commands here...
CGContextFlush(ctx);
CGContextSynchronize(ctx);
[[nsWindow contentView] unlockFocus];
[nsWindow flushWindow];
对Cocoa和OC不太了解,搜索过一些资料都是只能使用drawRect.
麻烦懂这方面的朋友帮忙看下,谢谢。