Hi list,

i have some issues in my app when rendering QCRenderer to MSAA Enabled FBO in a 
CVDisplaylink driven rendering loop. With 10.6.3 everything just worked fine, 
but with 10.6.4, this code makes my screen(!) glitching and lock my computer 
(MBP with nVidia9400), so i have to power off/on switch. I got no GL errors, 
just an exception message in kernel.log. With ATI based cards it seems to 
worked fine. I'm not a GL guru, well maybe i missed something, here is the code.

Any help will be much appreciated!

- (id) renderSynthAPlayerFBO:(CGLContextObj)context atTime:(NSTimeInterval)time 
withArguments:(NSDictionary *)args
{
        CGLContextObj cgl_ctx = context;
        
        CGLLockContext(cgl_ctx);
        
        int width = [resoWide intValue];
        int height = [resoHigh intValue];
        
        glPushAttrib(GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT);
         
        {

                if (playeraFBOneedsreset) 
                {
                        if (msaaRenderBufferSA != 0) {
                                //Delete resources
                                glDeleteRenderbuffersEXT(1, 
&msaaRenderBufferSA);
                                glDeleteRenderbuffersEXT(1, &depthBufferSA);
                                glDeleteFramebuffersEXT(1, &msaaFrameBufferSA);
                                glDeleteFramebuffersEXT(1, &synthaplayerfbo);
                                
                        }

                        if (synthaplayerimg==0) glGenTextures(1, 
&synthaplayerimg);
                        glGenFramebuffersEXT(1, &msaaFrameBufferSA);
                        glGenFramebuffersEXT(1, &synthaplayerfbo);
                        glGenRenderbuffersEXT(1, &depthBufferSA);
                        glGenRenderbuffersEXT(1, &msaaRenderBufferSA);
                        
                        playeraFBOneedsreset = NO;
                        
                }
                

        
                glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, msaaRenderBufferSA);
                glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 4, 
GL_RGBA8, width, height);
                
                glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthBufferSA);
                glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, 4, 
GL_DEPTH_COMPONENT24, width, height);
                
                glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, msaaFrameBufferSA);
                        
                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, 
GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, msaaRenderBufferSA);
                glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, 
GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthBufferSA);


                
                glMatrixMode(GL_PROJECTION);
                glPushMatrix();
                glLoadIdentity();
                
                glViewport(0, 0, width, height);
                
                glMatrixMode(GL_MODELVIEW);
                glPushMatrix();
                glLoadIdentity();

                glBindTexture(GL_TEXTURE_RECTANGLE_EXT, synthaplayerimg);
                glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, GL_RGBA8, width, 
height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

                glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, synthaplayerfbo);
                glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, 
GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_EXT, synthaplayerimg, 0);

                glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, msaaFrameBufferSA);
                
                // qcrenderer render
                [synthAPlayerRenderer renderAtTime:time arguments:args];
                [synthAPlayerContext flushBuffer];
                
                // restore states 
                glMatrixMode(GL_MODELVIEW);
                glPopMatrix();
                glMatrixMode(GL_PROJECTION);
                glPopMatrix();
                
                glPopAttrib();
        
                
                glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 
msaaFrameBufferSA);
                glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, synthaplayerfbo);
                
                glBlitFramebufferEXT(0, 0, width, height, 0, 0, width, height, 
GL_COLOR_BUFFER_BIT, GL_NEAREST);
                                

                // unbind FBO
                glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
                glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
                glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
                glBindRenderbufferEXT(GL_RENDERBUFFER_EXT,0);


        } 
        
        
        CGLUnlockContext(cgl_ctx);
        
        return [CIImage imageWithTexture:synthaplayerimg size:CGSizeMake(width, 
height) flipped:NO colorSpace:CGDisplayCopyColorSpace(kCGDirectMainDisplay)];
}       

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to