> When I load the view, I call the following method:
> 
> -(void)prepareOpenGL {
>     [[self openGLContext] makeCurrentContext];
>     
>     // Synchronize buffer swaps with vertical refresh rate
>     GLint swapInt = 1;
>     [[self openGLContext] setValues:&swapInt 
> forParameter:NSOpenGLCPSwapInterval]; 
>     
>       
>     GLint opacity = 0;
>       [[self openGLContext] setValues:&opacity 
> forParameter:NSOpenGLCPSurfaceOpacity];        
>       readyToDraw = YES;
>     
>     NSOpenGLPixelFormatAttribute attribs[] =
>     {
>         kCGLPFAAccelerated,
>         kCGLPFANoRecovery,
>         kCGLPFADoubleBuffer,
>         kCGLPFAColorSize, 24,
>         kCGLPFADepthSize, 24,
>         0
>     };
>     
>     pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
>     [self setPixelFormat:pixelFormat];
>     
>     if (!pixelFormat)
>         NSLog(@"No OpenGL pixel format");
> }

I'm not entirely sure why you're creating a pixelformat here -- it's not a 
pixelformat that matches your XIB's configuration either;  your XIB is 
configured for 16 bit color (5551) -- I wouldn't recommend this for performance 
reasons because 16bit color buffers aren't a particularly fast path on 
currently shipping hardware, and you lose a lot of alpha channel fidelity (you 
get 2 alpha levels instead of 256).

2 aux buffers is a bit unusual too -- are you using them for something?

> -(NSOpenGLPixelFormat *)pixelFormat {
>     return pixelFormat;
> }
> 
> Here is the drawRect method in my custom view:
> 
> 
> 
> -(void)drawRect:(NSRect)dirtyRect {   if(readyToDraw) {
>         glClearColor(0, 0, 0, 0);
>         glClear(GL_COLOR_BUFFER_BIT);
>               if(isSetup){
>                       if (backgroundShouldDraw == YES) {
>                               [self drawBackground];
>                               backgroundShouldDraw = NO;
>                       }
>                       [self draw];
>               }
>       }
> }


> Here is the render method for the Patch:
> 
> -(void)render {    glEnable(GL_DEPTH_TEST);
>     glClear(GL_DEPTH_BUFFER_BIT);
>     [patchRenderer renderAtTime:[NSDate timeIntervalSinceReferenceDate] 
> arguments:patchArguments];
> }

These look roughly correct at a glance.

You've got a root-level clear patch in your composition that clears both the 
color and depth buffers anyway, so these should be unnecessary unless you're 
planning on doing additional rendering outside of QC in your view.

Plugging away some more, it looks like you're subclassing CALayer 
(CAOpenGLLayer).  In this case, your pixelformat should probably match what 
your context's pixel format is.  (-[NSOpenGLView pixelFormat] can help get 
exactly the right thing).

Have you looked at QCCompositionLayer (which might be a better starting point 
for subclassing)?

--
Christopher Wright
[email protected]

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

Reply via email to