Mailing Lists: Apple Mailing Lists

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

some questions about CGWindowListCreateImage()



Hello

I have successfully built some code based on the Son of Grab developer sample, but I have a few questions,

What I am looking to do (and optimize), is grabbing an arbitrary window image texture, and keep it on the GPU for further processing by my application.

I have a timer based system with grabs a current CGImageRef of the windowID Ive specified, but have noticed that any sort of decent framerate makes the WindowServer process really churn, which in turn kills the framerate in my main host application.

I am wondering/speculating if this is due to some sort of readback off the GPU when calling CGWindowListCreateImage(). Ive checked OpenGL Driver Monitor but am not certain what to look for to indicate readback is happening or that it is indeed causing a large bottleneck.

So, is it possible to keep the CGImageRef from CGWindowListCreateImage() on the GPU (from what I understand a CGIImageRef can live anywhere in main memory or in vram - is this assumption incorrect?), and if so, how do I do it!

The code I am using to pull in the window image and that is called at my timer is as follows:

-(void) windowToImage
{
if(currentWindowImage && currentWindowImage != nil)
{
CGImageRelease(currentWindowImage);
}

currentWindowImage = CGWindowListCreateImage(imageBoundssingleWindowListOptionswindowIDimageOptions);

CGImageRetain(currentWindowImage);
}

and then I simply expose currentWindowImage to the outside world, to be polled at whatever rate it should be (to decouple sampling from the window server from external processing of the resulting image).

-(id)getCurrentFrame
{
return currentWindowImage;
}

Does it make sense to use CGWindowListCreateImage, or should I be looking at the OpenGL Screen Capture example? I quite like CGWindowListCreateImage as it lets me capture obscured windows, and only the window, which im not certain I can do based on a sampling of the OpenGL Screen to Movie code. I have no problems being 10.5 only.

Thanks for any advice.

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

This email sent to 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.