UPDATE (2014.06.25): a Twirl effect demo is also available with GLSL Hacker. Visit this thread for more information.
Today a new pixel hack for our shader library: the popular swirl (or whirl) effect, as usual coded in GLSL. You should be able to use the swirl effect in any OpenGL app with few modification. The principle of the swirl effect is to rotate the texture coordinates. I quickly coded a small GeeXLab demo to show the whirl post processing filter in action. You can interactively tweak the different parameters (radius, angle and swirl center position). The demo is available in GeeXLab code samples pack (PostFX_Swirl/ folder). You can download the complete code sample pack from this page or here:
I only tested the swirl GLSL effect with a Radeon card (HD 5850) + Cat 11.4 but it should work fine on NVIDIA boards. If it’s not the case, feel free to leave a comment. Now the complete post processing swirl / whirl shader in GLSL:
Source of the shader: I adapted this swirl WebGL code (too easy I know…) for GeeXLab.
Related posts:
|
|
来自: 勤奋不止 > 《游戏引擎cocos2d》