Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

QCRenderer output to NSImage



Hi,
I am using QCRenderer class in my application. It renders image to  NSView  using 
   
 [glContext flushBuffer];

And everything works OK, but I need to get renderer output as NSImage.
First I tried to get data from NSView using data = "" dataWithPDFInRect: myViewRect] and then create NSImage from data. However data has no pixels information in it.
Then researching the web I read about glReadPixels function. So I tried this:

 NSBitmapImageRep * rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:640 pixelsHigh:480 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:640*3 bitsPerPixel:24];
    glReadPixels(0,0,640,480,GL_RGB,GL_UNSIGNED_BYTE,[rep bitmapData]);

    flattenedImage = [[NSImage alloc] initWithSize:NSMakeSize(640.0,480.0)];
    [flattenedImage addRepresentation:rep];

This did not do job as well. Image is just ablack area.

Am I missing something?

Any help will be appreciated.

Thanks,

Sergei 

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

This email sent to email@hidden

References: 
 >color difference on macintel vs powerpc using QCTV frame export... (From: Alexander Huber <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.