1
저는 그래픽 프레임 워크 용 코코아 래퍼를 만들고 있습니다.NSWindow에서 그리기
마침내 내가이 일을하고있어, 물건을 그리려면 :
- (void)drawRect:(NSRect)rect
{
CGContextRef ctx = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextDrawImage(ctx, NSRectToCGRect(rect), image);
}
을 NSView
의 서브 클래스 내부.
NSOpenGL
물건을했다 보았다
// Settings, depending on fullscreen or not
NSOpenGLPixelFormatAttribute windowedAttrs[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAScreenMask,
(NSOpenGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID()),
NSOpenGLPFADepthSize,
(NSOpenGLPixelFormatAttribute)16,
(NSOpenGLPixelFormatAttribute)0
};
NSOpenGLPixelFormatAttribute fullscreenAttrs[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAScreenMask,
(NSOpenGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID()),
NSOpenGLPFAFullScreen,
NSOpenGLPFADepthSize,
(NSOpenGLPixelFormatAttribute)16,
(NSOpenGLPixelFormatAttribute)0
};
NSOpenGLPixelFormatAttribute* attrs = fullscreen ? fullscreenAttrs : windowedAttrs;
// Create pixel format and OpenGL context
ObjRef<NSOpenGLPixelFormat> fmt(
[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]);
::context = [[NSOpenGLContext alloc] initWithFormat: fmt.obj() shareContext:nil];
왜 그들은 모든 것을거야? 내 "단순한"방식으로 괜찮습니까?
정상적으로 작동한다면, 괜찮습니다. 즉, Plutarch lese von großen Menschen_! – ryyst