Summary
In this chapter, we have learnt how to use the GPU to offload the CPU in some rendering tasks. The butterflies example taught us how, parting from a plain array of 3D points, we can create on the fly more elaborated (in terms of mesh complexity) structures using only the GPU. A good exercise for you would be to give life to the butterflies by animating their wings (easy to achieve, changing the wings' aperture angle according to the time), coloring each butterfly instance differently based on gl_PrimitiveID
, or calculating the strips' normal vectors to include lighting calculations.
In the next chapter, we will increase the flexibility of our renders with the usage of the compute shaders, which will allow us to perform other GPU calculations without being constrained by the pipeline's execution order.