In my latest game prototype, I am using the following process per frame:
generateFluidStampCollisionsDamage()
-render collision data using the detectCollisionProgram
-read the contents of the texture on the CPU using glReadPixels
-for each collision point in that texture that has non-zero alpha, see which stamp(s) are at that location
processCollectedBlackeningPoints
- blackens things
As you can see, step 1b calls glReadPixels, which is ridiculously slow.
Do you have any ideas on how to redo this process so that it runs entirely on the GPU? I was thinking of somehow using a texture that contains the id of the stamp at location x,y. However, this only allows collision to damage to one stamp per collision pixel. That's not really optimal.
The source code is not the best to look at.
