Adding whirl effect on DirectX/OpenGL application
After we have finished rendering a frame either using DirectX or OpenGL in C++, I would like to add this "swirling" effect just on a portion of the frame. Something like this below:
So how do we normally 开发者_StackOverflow社区achieve this?
You could either:
- Render a grid of vertices and use a vertex shader to rotate each vertex around the center according to its distance from the center. This would require lots of vertices towards the center, to maintain clean curvature.
- Render a single quad and use a fragment shader to similarly rotate the texture-coordinate. This would render more accurately, but would also be slower than the fragment shader.
精彩评论