QCRenderer.renderAtTime fails with 'invalid framebuffer operation'

350 Views Asked by At

I initialize my QCRenderer like this:

let glPFAttributes:[NSOpenGLPixelFormatAttribute] = [
    UInt32(NSOpenGLPFABackingStore),
    UInt32(0)
]
let glPixelFormat = NSOpenGLPixelFormat(attributes: glPFAttributes)
if glPixelFormat == nil {
    println("Pixel Format is nil")
    return
}
let openGLView = NSOpenGLView(frame: glSize, pixelFormat: glPixelFormat)
let openGLContext = NSOpenGLContext(format: glPixelFormat, shareContext: nil)
let qcRenderer = QCRenderer(openGLContext: openGLContext, pixelFormat: glPixelFormat, file: compositionPath)

Further down in the code, I call renderAtTime like this:

if !qcRenderer.renderAtTime(frameTime, arguments: nil) {
    println("Rendering failed at \(frameTime)s.")
    return
}

which always produces this error message:

2014-10-30 15:30:50.976 HQuartzRenderer[3996:692255] *** Message from <QCClear = 0x100530590 "Clear_1">:
OpenGL error 0x0506 (invalid framebuffer operation)
2014-10-30 15:30:50.976 HQuartzRenderer[3996:692255] *** Message from <QCClear = 0x100530590 "Clear_1">:
Execution failed at time 0.000
2014-10-30 15:30:50.976 HQuartzRenderer[3996:692255] *** Message from <QCPatch = 0x100547860 "(null)">:
Execution failed at time 0.000
Rendering failed at 0.0s.

The Quartz Composition is just a simple GLSL shader which runs just fine in Quartz Composer. Here's a screenshot of the Quartz Composer window: Quartz Composition

There's not much on the internet on this that I could find. I hope someone here knows something that might help.

By the way, I know that I could just initialize the QCRenderer like

let qcRenderer = QCRenderer(offScreenWithSize: size, colorSpace: CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), composition: qcComposition)

but I want to take advantage of my GPU's multisampling capabilities to get an antialiased image. That's gotta be more performant than rendering at 4x size, then manually downsizing the image.

Edit: Changed pixel format to

let glPFAttributes:[NSOpenGLPixelFormatAttribute] = [
    UInt32(NSOpenGLPFAAccelerated),
    UInt32(NSOpenGLPFADoubleBuffer),
    UInt32(NSOpenGLPFANoRecovery),
    UInt32(NSOpenGLPFABackingStore),
    UInt32(NSOpenGLPFAColorSize), UInt32(128),
    UInt32(NSOpenGLPFADepthSize), UInt32(24),
    UInt32(NSOpenGLPFAOpenGLProfile),
    UInt32(NSOpenGLProfileVersion3_2Core),
    UInt32(0)
]
0

There are 0 best solutions below