My task is to create a fountain simulation with water particles and water surface collision. To this point I have created water surface using one shader, and another shader to create fountain particles (fountain particles’ shader is also using transform feedback mechanism).
My question is: how can I make/detect fountain particles and water surface collision? – I would like to know, how can I get/connect information from plane’s shader/GL buffer and particle’s shader/GL buffer to make a collision – I know water wave equation and methods for collision detection – I just don’t know for what allows OpenGL’s API.
The problem you’re describing doesn’t match OpenGL’s job description. OpenGL is a drawing API, its purpose is to draw nice pictures. Things like collision detection are completely outside the scope of OpenGL.
However you can use OpenGL to implement a image based algorithm to perform image based tests matching your problem. In your case I’d render the water surface from atop in a orthographic projection, then render each particle with depth testing enabled. Using Occlusion Query I’d test if the particle was still visible. For each frame I’d compare if the particle visibility changed: If it disappeard it went underwater and collided.
This method works, but frankly I’d say it’s totally overengineered. Just test if the particle height above ground is larger than the mean water level; for small ripple waves this is accurate enough.