In this recipe, we will build on top of the previous recipe and add collision detection and response to the cloth model.
The code for this recipe is contained in the Chapter8/TransformFeedbackClothCollision
directory. For this recipe, the setup code and rendering code remains the same as in the previous recipe. The only change is the addition of the ellipsoid/sphere collision code.
Let us start this recipe by following these simple steps:
Generate the geometry and topology for a piece of cloth by creating a set of points and their connectivity. Bind this data to a buffer object as in the previous recipe.
Set up a pair of vertex array objects and buffer objects as in the previous recipe. Also attach buffer textures for easier access to the buffer object memory in the vertex shader.
Generate a transform feedback object and pass the attribute names that will be output from our deformation...