Hello,
On Wed, May 20, 2009 at 7:43 PM, Frank Goenninger frgo@me.com wrote:
:foreign-object (c? (progn (when (and (^foreign-object)
I think the problem is here, you have a slot dependent on itself. To access slot previous value use .cache symbol macro, like this:
(defmd color () red green blue alpha foreign-object
:md-name (gensym "CELLO-COLOR-") :red (c-in 0) :green (c-in 0) :blue (c-in 0) :alpha (c-in 0) :foreign-object (c? (progn (when (and .cache (not (null-pointer-p .cache))) (foreign-free .cache)) (let ((fo (foreign-alloc :float :count 4))) (when (not (null-pointer-p fo)) (progn (setf (mem-aref fo :float 0) (/ (^red) 255.00000000000f0)) (setf (mem-aref fo :float 1) (/ (^green) 255.0000000000f0)) (setf (mem-aref fo :float 2) (/ (^blue) 255.0000000000f0)) (setf (mem-aref fo :float 3) (/ (^alpha) 255.0000000000f0))))))))
Regards, Jakub Higersberger