Hello,

I am trying to programmatically create an NSOpenGLView and have it layer-backed. I would use CAOpenGLLayer except that I am using a subclass of NSOpenGLView and I don't have the time to rewrite it. Now, for some reason I can not get the NSOpenGLView to show up. If I use the same subclassed NSOpenGLView in Interface Builder everything shows up fine and I can communicate with it how I need to, but if I create it programmatically it simply never shows up.

The weird thing is that I think it is getting created correctly but is just not becoming visible. The NSOpenGLView plays a QTMovie and even though it doesn't show up I can still hear the audio from the QTMovie playing back. Also, I've added a bunch of NSLog's in the subclass and they all get triggered when I try to communicate with the version that was created programmatically even though it never shows up.

Here's my code ... what am I doing wrong?

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];
_______________________________________________

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