开发者

Howto draw a rect on screen. NSOpenGLContext vs transparent NSWindow + custom NSView

I'm reading pixels from an area of the main screen via NSOpenGLContext. Now I would like to draw a rect around that area to indicate where it actually is. How would I do this? My first thought was the "Cocoa wa开发者_Go百科y": create a transparent fullscreen NSWindow and a custom NSView to draw the rectangle path. But that feels a bit too complicated. Isn't it possible to draw directly on the NSOpenGLContext?


If you want to draw over elements not inside your application the floating window is the only correct way. There’s really no complication except mapping positions properly, which is easy to do with the coordinate-space conversions available on NSView and NSWindow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜