From 4f66a49fc209e1f70453dce82dfc0f66faa3a423 Mon Sep 17 00:00:00 2001 From: Sam Hocevar <sam@hocevar.net> Date: Mon, 9 Sep 2013 16:56:49 +0000 Subject: [PATCH] btphystest: use discard in fragment shader instead of AlphaFunc. --- test/btphystest.cpp | 2 -- test/front_camera_sprite.lolfx | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/btphystest.cpp b/test/btphystest.cpp index ac0610ef..3efc94d3 100644 --- a/test/btphystest.cpp +++ b/test/btphystest.cpp @@ -58,8 +58,6 @@ BtPhysTest::BtPhysTest(bool editor) { m_loop_value = .0f; - g_renderer->SetAlphaFunc(AlphaFunc::Greater, 0.0); - #if CAT_MODE /* cat datas setup */ m_cat_texture = Tiler::Register("data/CatsSheet.png", ivec2(0), ivec2(0,1)); diff --git a/test/front_camera_sprite.lolfx b/test/front_camera_sprite.lolfx index fc8fa4ba..56e09017 100644 --- a/test/front_camera_sprite.lolfx +++ b/test/front_camera_sprite.lolfx @@ -45,5 +45,9 @@ const float PI = 3.14159265358979323846264; void main(void) { - gl_FragColor = texture2D(in_texture, pass_texcoord.xy) * pass_color; + vec4 color = texture2D(in_texture, pass_texcoord.xy); + if (color.a < 0.01) + discard; + gl_FragColor = color * pass_color; } +