shiffman / LearningProcessing

A repo for examples from the book Learning Processing
http://learningprocessing.com
606 stars 276 forks source link

Example 19-6/Exercise 19-5: ellipse() doesn't work in clientEvent #210

Open pippinbarr opened 7 years ago

pippinbarr commented 7 years ago

As far as I've been able to tell, calling drawing functions (like ellipse()) inside the clientEvent() function isn't actually drawing anything to the canvas.

My workaround was to save received data to an array and draw in draw(), but is this a known issue or conceivably something I'm screwing up myself. Can't seem to find anything easily online about this.

(This is in Processing 3.3.2 on Mac OS 10.12.4)

shiffman commented 7 years ago

Ah, thanks for filing this. Yes, this is my mistake to draw in clientEvent(), this will cause problems as it happens in a separate "thread." I'll try look into a better way to do this soon.