On 3/29/24 14:32, Vanessa Freudenberg wrote:
"self changed" will invalidate the entire morph area. "self invalidRect: rect" will only invalid the specified rectangle.
I thought I tried that, but I might have put it on the model wrapper, not the morph. Thanks!
For the second question I'm not entirely sure that's true?
For historic reasons Morphic uses global coords even though most other rendering frameworks use parent-relative coordinates (I think Cuis may have fixed that, not sure). If I write a morph that always draws starting at 0@0 then it's always drawn in the top-left screen corner (though it might not be visible there unless that area gets invalidated).
However – the HandMorph paints its submorphs into a caching canvas, so they don't have to be redrawn for every mouse move. If you never invalidate your morph then it is only drawn once into that canvas and then it /*looks*/ like it's being dragged around. But if the morph updates, e.g. you call "self changed" in your drawOn: method (don't do that! only for testing) then you will see that even while being dragged in the hand, it will always be drawn in the top-left screen corner.
That explains a lot! I understand the lack of clipping is for things like shadows, but I haven't figured out why drawing is done with global coordinates.
I always forget #translateBy:during: exists when drawing, but I've previously only drawn simple things.
On the other hand (pun intended), if you are using OpenGL (are you?)Nice one.
I'm not using OpenGL, but I'm familiar with drawing to a buffer. I'm doing raycasting for a 3D maze game... like the screen saver on my old computer... but entirely in Smalltalk. It should be simple, but so far I've gotten a segmentation fault from drawing primitives and a keyhole... which looks cool, but is wrong.