Thoughts?? TIA.
I've upgraded my machine to Lion a while ago and finally got around to running
some of my Xcode work, and ran across this issue trying to bring a simple
movie layer composition up full screen on a second monitor. I lock in the
monitor to black but no video shows.
In the console: 2012-01-12 21:10:49.804 My App Name[84773:407] invalid
fullscreen drawable
Plus a bunch of warning about plugins I am not using, but not important right
away?
I had a warning with the NSOpenGLContext regarding setValues using the old
kCGLCPSwapInterval parameter, so I swappers that over to NSOpenGLCPSwapInterval
which removed the warning, but still I get a black screen. The composition
plays fine in QC, it is just a standard movie player with billboard.
At the tail end of the log I see this:
2012-01-12 21:10:50.216 The Media Device[84773:407] *** QCPlugIn: Bundle at
path "/Library/Graphics/Quartz Composer Plug-Ins/Backdrops.plugin" is not a
valid Quartz Composer plug-in
Here's the code for setting up the QCRenderer:
-(void)setupRenderer:(int)screenNumber {
CGDisplayErr err;
CGDirectDisplayID dspys [[[NSScreen screens] count]];
CGDisplayCount dspyCnt;
//Load composition file path
NSString *path = [[NSString alloc] initWithString:[[NSBundle
mainBundle] pathForResource:@"Test Video Player.qtz" ofType:nil]];
[path retain];
err = CGGetOnlineDisplayList ([[NSScreen screens] count], dspys,
&dspyCnt); if (err != CGDisplayNoErr) {
NSLog(@"Cannot get display list");
[NSApp terminate:nil];
}
CGDisplayCapture(dspys[screenNumber]);
_screenSize.width = CGDisplayPixelsWide(dspys[screenNumber]);
_screenSize.height = CGDisplayPixelsHigh(dspys[screenNumber]);
GLint value = 1;
NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFAFullScreen,
NSOpenGLPFAScreenMask,
CGDisplayIDToOpenGLDisplayMask(dspys[screenNumber]),
NSOpenGLPFANoRecovery,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAAccelerated,
NSOpenGLPFADepthSize, 24,
(NSOpenGLPixelFormatAttribute) 0
};
NSOpenGLPixelFormat* format = [[[NSOpenGLPixelFormat alloc]
initWithAttributes:attributes] autorelease];
//Create the fullscreen OpenGL context on the main screen
(double-buffered with color and depth buffers)
_openGLContext = [[NSOpenGLContext alloc] initWithFormat:format
shareContext:nil];
if(_openGLContext == nil) {
NSLog(@"Cannot create OpenGL context");
[NSApp terminate:nil];
}
[_openGLContext setFullScreen];
[_openGLContext setValues:&value forParameter:NSOpenGLCPSwapInterval];
//Create the QuartzComposer Renderer with that OpenGL context and the
specified composition file
_renderer = [[QCRenderer alloc] initWithOpenGLContext:_openGLContext
pixelFormat:format file:path];
if(_renderer == nil) {
NSLog(@"Cannot create QCRenderer");
[NSApp terminate:nil];
}
//Create a timer which will regularly call our rendering method
_renderTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0 /
(NSTimeInterval)kRendererFPS) target:self selector:@selector(_render:)
userInfo:nil repeats:YES] retain];
}
- (void) renderWithEvent:(NSEvent*)event
{
NSTimeInterval time = [NSDate
timeIntervalSinceReferenceDate];
NSPoint mouseLocation;
NSMutableDictionary* arguments;
//Let's compute our local time
if(_startTime == 0) {
_startTime = time;
time = 0;
}
else
time -= _startTime;
//We setup the arguments to pass to the composition (normalized mouse
coordinates and an optional event)
mouseLocation = [NSEvent mouseLocation];
mouseLocation.x /= _screenSize.width;
mouseLocation.y /= _screenSize.height;
arguments = [NSMutableDictionary dictionaryWithObject:[NSValue
valueWithPoint:mouseLocation] forKey:QCRendererMouseLocationKey];
if(event)
[arguments setObject:event forKey:QCRendererEventKey];
//Render a frame
if(![_renderer renderAtTime:time arguments:arguments])
NSLog(@"Rendering failed at time %.3fs", time);
//Flush the OpenGL context to display the frame on screen
[_openGLContext flushBuffer];
}
- (void) _render:(NSTimer*)timer
{
//Simply call our rendering method, passing no event to the composition
[self renderWithEvent:nil];
}
- (void) sendEvent:(NSEvent*)event
{
//If the user pressed the [Esc] key, we need to exit
if(([event type] == NSKeyDown) && ([event keyCode] == 0x35))
[NSApp terminate:nil];
//If the renderer is active and we have a meaningful event, render
immediately passing that event to the composition
if(_renderer && (NSEventMaskFromType([event type]) &
kRendererEventMask))
[self renderWithEvent:event];
//else
// [super sendEvent:event];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [email protected]