QuartzCrystal "unable to render" after 4 frames

Hi,

I have an issue with Quartz Crystal, while I'm trying to render a qtz that use a custom plugin (OpenCV image provider). I'm passing a movie into the plugin, then output on a sprite. Nothing terrific...

At between 4 and 10 frames rendered I have this message (translated from French, as QCrystal is very well translated) : "Unable to perform the offscreen rendering".

Could it be that QCrystal doesn't like my way to output images (see code below) ? I'm very bad at manaqging OpenGL and image providers, very very bad :-/

Any advice would be highky appreciated, as I'm in a urge with this rendering ! Thanks a lot !

 
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            glClearColor(0., 0., 0., 0.);
            glLoadIdentity();
 
            glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT);
            glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 
            GLuint tex = [imgCV generateTextureInContext:cgl_ctx];
 
            self.outputImage =  [context outputImageProviderFromTextureWithPixelFormat:pixelFormat
                                                                            pixelsWide:[imgCV getSize].width
                                                                            pixelsHigh:[imgCV getSize].height
                                                                                  name:tex
                                                                               flipped:YES
                                                                       releaseCallback:textureReleaseCallback
                                                                        releaseContext:NULL
                                                                            colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)
                                                                      shouldColorMatch:YES];
 
 
 
            glPopClientAttrib();
            glPopAttrib();

smokris's picture
Re: QuartzCrystal "unable to render" after 4 frames

@benoitlahoz: I don't see anything in the pasted excerpt that I'd guess would trigger an offscreen rendering error, but I'm not well-versed in the semantics of the Official QC Plugin API. What's the contents of textureReleaseCallback?

Does the offscreen rendering error still occur if you remove your custom plugin? If so, could you attach (or email to info@kineme.net) a trimmed-down version of your composition? (Keep removing things until the problem goes away, then go back one step.)

If not, could you attach (or email) your custom plugin and a trimmed-down composition using it that causes the error to occur?

benoitlahoz's picture
Re: QuartzCrystal "unable to render" after 4 frames

Thanks @smokris,

In fact, after some other tests it seemed... totally esoteric ! Then I had a last test trying with different output sizes. And I got it : some sizes work, some don't. Not really understandable, as I'm trying to output a movie of the same size of the input movie. I guess it must be something with resizing in OpenCV or in my texture generation...

It seems that it only happens with the ProRes422 encoded file (other is PhotoJPEG). I'm performing other tests.

Comp + plugins are attached, source is in your mailbox.

Thanks again !

PreviewAttachmentSize
LogPol4Smokris.zip8.43 MB

cybero's picture
Re: QuartzCrystal "unable to render" after 4 frames

To confirm , within Lion, and having to use Kineme Video Tools to provide the video action as Movie Importer still fails to work correctly for me in Composer in Lion, both compositions [as in both movies] failed to render successfully past 4 or 5 frames with Crystal, whilst using your plugin.

The settings chosen were for ProRes422 1920*1080 at Maximum quality.

Without using the intervening plugin, which does produce some nice results BTW, the Crystal renders were successful.

I shall be checking this out in Snow in due course, to see if that makes any difference.

Post Script

Quartz Crystal 2 in Snow also fails to render the movies from the compositions correctly.

I also found in Snow that there seemed to be a cache issue, so that Preview mode would continue to show the Scanner movie even though the CourVersJarSeuillé movie was the one that was hooked up and saved into a separate Quartz Composer file.

When trying to achieve renders in Snow various sizes and codecs were attempted. PhotoJPEG [ProRes not being available in Snow], H.264, Animation.

benoitlahoz's picture
Re: QuartzCrystal "unable to render" after 4 frames

In Lion, I manage to render the 2048x768 movie at half size (1024x384). As OpenCV images are a bit tricky (at least for me) to convert, I guess it might be my GL texture creation that is buggy. What I don't understand is why it goes OK in QC and not in Quartz Crystal.

FYI, and as it might be important, I have a trouble with VDMX too. The very new version crashes with this plugin, the older one didn't.

vade's picture
Re: QuartzCrystal "unable to render" after 4 frames

You have to be very careful with OpenGL state. You also have to be very careful with pixel storage, because GL textures are uploaded lazily.

Additionally, VDMX is threaded, so your plugin, and its host QCRenderer runs on a secondary thread. You may be making assumptions about threading since in the QC Editor, rendering happens on the main thread.

Any reason you are calling clear when you are outputting an image? That seems unnecessary.

benoitlahoz's picture
Re: QuartzCrystal "unable to render" after 4 frames

Thanks @vade for this information ! About VDMX, I'm running with multithreading disabled, but I have a trouble with CVDisplayLink in the crash report. So, I googlized it and found : http://prod.lists.apple.com/archives/mac-opengl/2012/Jan/msg00027.html

I'm on an iPhone right now, because it's late in France and I'll run the computer tomorrow, but I'm not sure I did actually lock/unlock the context. I'm very beginner at GL as you can see, and thought that I had to clear at every frame.

I tried to implement a FBO output, with examples from your plugins, with no success. :-/ Next step !