add visual below finger swipe, Triangle strip like fruit ninja Andengine

不羁岁月 提交于 2019-12-01 08:05:35

Here is a solution in LibGDX. It uses GL_TRIANGLE_STRIP.

https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Finger-Swipe

The final solution uses two triangle strips and a custom texCoord attribute, allowing for us to use a lookup texture to achieve fake (but efficient) anti-aliasing. A more efficient/flexible anti-aliasing would use shaders and a single triangle strip. Use vertex attribute -1.0 for the top and 1.0 for the bottom edge of your swipe, and 1.0 for the tips. Then in the frag shader, use abs() -- so 0.0 means "center" and 1.0 means "edge."

Something like this:

    color.a *= smoothstep(0.0, 2./thickness, 1.0-abs(vTexCoord.t));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!