Update Cinder app from another class

Hello everyone.

I created a simulation program that simulate cell behaviour and I would like to see in a 3d View the cell (as simple sphere). The simulatior has an endless while which evaluate the new position of the cells and their Color (based on biological information).

Now my problem.
I was able to create a class with the basic function (draw(), setup()) and I was able to depict several spheres in the scene. I created a method which will set the position of the spheres BUT when I call it the windows remain white and busy. I think the while cycle don’t allow cinder to render.

How can I solve this problem ?
Thanks

Hi,

You are probably right. After you call the function with the endless while loop, the program stops there forever.
One solution could be that you only calculate one step of the simulation in an update function. You call that in the main app update(), then draw it in draw(). Would this work for your case?

-Gabor

Thanks for the answer.
I solved following the example FlickrTestMultithreaded .
I created a separate thread for my application and pass the data trough a ConcurrentCircularBuffer.

1 Like