Re: A very customized window
Re: A very customized window
- Subject: Re: A very customized window
- From: Ken Thomases <email@hidden>
- Date: Sat, 16 Apr 2011 23:08:24 -0500
On Apr 16, 2011, at 4:57 PM, eveningnick eveningnick wrote:
> Could you give me a hint how did QuickTime Player developers manage to
> display a window the way it looks now? Specifically i can't
> understand, how they made the "Movie control" toolbar, that floats
> only within the "movie window"?
At a guess, they are using Core Animation layers. They are probably manually repositioning the movie control's layer (or layer-backed view) manually in response to the mouse-dragging events, just as you would to reposition the window.
> Reading through NSOpenGLView documentation, i found the note that this
> view can't contain subviews. Though i am pretty sure the "movie view"
> is NSOpenGLView (am i wrong here?). Do they display an another
> "control" window somehow in an "always on top of the NSOpenGLView"
> manner?
Core Animation layers can contain OpenGL rendering while still permitting other layers on top. For example, see the LayerBackedOpenGLView sample code:
http://developer.apple.com/library/mac/#samplecode/LayerBackedOpenGLView/
Alternatively, you can use a non-NSOpenGLView-derived view, backed by a CAOpenGLLayer (or hosting a layer hierarchy that includes one). See the CALayerEssentials sample code:
http://developer.apple.com/library/mac/#samplecode/CALayerEssentials/
> I am wondering, why is NSOpenGLView considered to be the preferred way
> to display a set of images? Why is every image operation revolving
> around OpenGL? I understand that eventually it all comes through the
> videoadapter, but what if i just display an RGB picture that i have in
> an RGB buffer (CVImageBufferRef). Will OpenGL give me some benefits
> just for rendering it on the view against drawing image onto something
> like "NSImageView"?
This is outside my area of expertise, but I'm not sure it's entirely true that OpenGL is _the_ preferred way to display sequences of images. I imagine that QTKit can do the same sort of thing quite handily. ;) And, of course, for simple animations, regular old Cocoa image drawing may suffice. (That doesn't necessarily imply the use of NSImageView. You can draw an NSImage from within the -drawRect: of any custom NSView class, for example.)
The advantage of OpenGL is presumably performance gained from asynchrony -- being able to prepare a next frame for display while the GPU is working on displaying the current frame.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden