Why am I getting a blank screen when using shader?

浪子不回头ぞ 提交于 2019-12-04 19:28:40

The problem is that the image you're using, "badlogic.jpg" has no alpha channel. This shader draws an outline within the bounds of the sprite along the border between high alpha and zero alpha. A JPG file has no alpha channel, so there's no border to draw anything on.

By the way, you need to update your camera's width and height in resize, so the view won't be distorted.

That fragment shader from the tutorial could use some optimization. It has multiple dependent texture reads and multiple if statements. if statements should be replaced with calls to clamp. An exhaustive search of nearby pixels is probably unnecessary to detect edges unless the sprite has some super thin areas.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!