0

My aim is to bundle a Quartz Composer file into Xcode and build a .saver file. I am currently using the Xcode pre-made template but having problems getting the screensaver to work. I am importing the .qtz file into the project and using QCView to render it on screen, however when I test the built .saver file all I see is a black screen.

- (instancetype)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview
{
    self = [super initWithFrame:frame isPreview:isPreview];
    if (self) {
        [self setAnimationTimeInterval:1/30.0];

        NSRect viewBounds = [self bounds];

        //create the quartz composition view
        qcView = [[QCView alloc] initWithFrame: NSMakeRect(0, 0, viewBounds.size.width, viewBounds.size.height)];
        //make sure it resizes with the screensaver view
        [qcView setAutoresizingMask:(NSViewWidthSizable|NSViewHeightSizable)];

        //match its frame rate to your screensaver
        [qcView setMaxRenderingFrameRate:30.0f];

        //get the location of the quartz composition from the bundle
        NSString* compositionPath = [[NSBundle mainBundle] pathForResource:@"QuartzComposerFileName" ofType:@"qtz"];
        //load the composition
        [qcView loadCompositionFromFile:compositionPath];


        //add the quartz composition view
        [self addSubview:qcView];

    }
    return self;
}
AccDa
  • 145
  • 1
  • 7

1 Answers1

0

I have tried doing the same thing using Xcode 6.4 and it appears that QCView is not working with Xcode 6.4. I put an image in the view and set the size of my QCView to be smaller than the frame. I see a black box for the subview but it never renders. This is true for even the most basic QC composition.

You might be able to get it to work by rendering the composition yourself using a QCRenderer. I gave up before trying this, but here is the documentation: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/QuartzFramework/Classes/QCRenderer_Class/

George S
  • 630
  • 1
  • 4
  • 6