2D OpenGL ES Metaballs on android

2019-07-16 05:29发布

问题:

I have an array of points (balls) in 2D-space which I want to be displayed as 2D Metaballs.

For learning purposes I implemented it on a canvas by

  1. create an array which represents each pixel
  2. iterate through this array and set a value depending on the distance to every ball for each pixel
  3. iterate again and remove everything below a threshold

That works fine but is extremely slow, as expected. I am pretty new to OpenGL and played around with various samples but I did not manage to make 2D OpenGL Metaballs. Current state is that I have a working representation of my balls by drawing a sprite for each ball (using cocos2d-android-1 if that matters).

Can you provide me some (newbie friendly) steps I need to take?