On Oct 3, 2008, at 9:46 AM, Albert Martin wrote:

videoLayer = [[CALayer layer] retain];
                
NSOpenGLPixelFormatAttribute attributes[] = {
        NSOpenGLPFANoRecovery,
                
       NSOpenGLPFAColorSize, 24,
       NSOpenGLPFAAlphaSize, 8,
       NSOpenGLPFADepthSize, 16,
       NSOpenGLPFADoubleBuffer,
       NSOpenGLPFAAccelerated,
0};
                
presentationVideoLayer = [[[IWVideoView alloc] initWithFrame: NSMakeRect(0, 0, frameRect.size.width, frameRect.size.height) pixelFormat: [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]] retain];
[presentationVideoLayer setLayer: videoLayer];
[presentationVideoLayer setWantsLayer: YES];
        
[[self layer] addSublayer: videoLayer];
        
[presentationVideoLayer setNeedsDisplay: YES];
[[presentationVideoLayer openGLContext] update];

There are number issues here.

One is as Matt mentioned, your using a plain CALayer when a CAOpenGLLayer is called for. A plain CALayer will not render OpenGL content. In this simple case, you will likely want to just let AppKit create the layer for you (by not calling setLayer:).

Two, your trying to add a layer as a sublayer of itself. That won't work for obvious reasons :). But then, you shouldn't be playing with this layer anyway.

Third, and this one might not actually be an issue for you, is that there is a bug in AppKit that causes layer-backed NSOpenGLViews to use the wrong pixel format for their CAOpenGLLayers. Specifically, if you really need a depth buffer (and aren't just copying a pixel format from elsewhere) then you will need to create your own CAOpenGLLayer subclass and do the proper work there. You can see the CALayerEssentials sample <http://developer.apple.com/samplecode/CALayerEssentials/index.html > for details on how to do that.

This is just an aside, but I notice when you create your view you do alloc/init.../retain - this usually indicates that you are going to leak sometime in the future as you are claiming two counts of ownership on the view. This may be what you want, but it usually isn't, so thats why I point it out.
--
David Duncan
Apple DTS Animation and Printing

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to