[Openmcl-devel] iSight progress
Ron Garret
ron at awun.net
Wed Jan 30 08:12:05 PST 2008
On Jan 29, 2008, at 11:25 PM, R. Matthew Emerson wrote:
>
> On Jan 30, 2008, at 12:35 AM, Ron Garret wrote:
>
>> (setf qcv (make-instance 'ns:q-c-view))
>
> It might not matter in this case, but NSView and subclasses need to
> be initialized with initWithFrame:. Something like:
>
> (setf qcv (make-instance 'ns:q-c-view :with-frame (ns:make-ns-rect 0
> 0 100 100)))
>
Doesn't seem to make a difference one way or the other. I think
QCViews size themselves automatically based on the composition they
are rendering and/or the window they are in.
>
>> (#/loadCompositionFromFile: qcv #@"Cam.qtz")
>
>> (#/startRendering qcv)
>> (#/setContentView: w qcv)
>>
>
> If I put in (#/setAutostartsRendering: qcv t) and then minimize and
> restore the window, it shows the live camera view.
>
How odd. That works for me too. Doesn't seem like a good long-term
solution though.
>> (setf bmrep (#/bitmapImageRepForCachingDisplayInRect:
>> qcv
>> (ns:make-ns-rect 0 0 300 200)))
>>
>>
>>
>> Now whenever I do this:
>>
>>
>>
>> (#/cacheDisplayInRect:toBitmapImageRep: qcv (ns:make-ns-rect 0 0
>> 300 200)
>> bmrep)
>>
>
> Does -[QCView createSnapshotImageOfType:] work any better? Since QC
> is drawing to an OpenGL context, maybe the NSView method doesn't do
> the job.
I haven't tried that yet, but I did try snapshotImage. When I didn't
have the live image working, snapshotImage actually worked (in
conjunction with calling cacheDisplayInRect:toBitmapImageRep: to force
the image to update. It was weird -- there was a two-frame delay
between calling cacheDisplayInRect:toBitmapImageRep: and having that
image show up as the result of calling snapshotImage.
But when I tried calling snapshotImage while live update was running
it froze my Mac (even the cursor froze) and required a reboot. :-(
Another bit of weirdness: sometimes calling (objc:load-framework
"Quartz" :quartz) causes MCL to enter a spin cycle (i.e. the SBBOD
shows up and I have to force-quit). This problem is intermittent, but
seem to happen only when I evaluate the form from a Hemlock window.
rg
More information about the Openmcl-devel
mailing list