package stray.util.render;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;

public class StencilMaskUtil {

	/**
	 * call this BEFORE rendering with ShapeRenderer and BEFORE drawing sprites, and AFTER what you want in the background rendered
	 */
	public static void prepareMask() {
		Gdx.gl20.glDepthFunc(GL20.GL_LESS);

		Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);

		Gdx.gl20.glDepthMask(true);
		Gdx.gl20.glColorMask(false, false, false, false);
	}

	/**
	 * call this AFTER batch.begin() and BEFORE drawing sprites
	 */
	public static void useMask() {
		Gdx.gl20.glDepthMask(false);
		Gdx.gl20.glColorMask(true, true, true, true);

		Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);

		Gdx.gl20.glDepthFunc(GL20.GL_EQUAL);
	}
	
	/**
	 * call this AFTER batch.flush/end
	 */
	public static void resetMask(){
		Gdx.gl20.glDisable(GL20.GL_DEPTH_TEST);
	}
}

@@ -297,34 +297,32 @@
 ask() %7B%0A%09%09Gdx.gl
-20
 .glDepthFunc(GL2
@@ -334,34 +334,32 @@
 LESS);%0A%0A%09%09Gdx.gl
-20
 .glEnable(GL20.G
@@ -374,34 +374,32 @@
 TEST);%0A%0A%09%09Gdx.gl
-20
 .glDepthMask(tru
@@ -402,34 +402,32 @@
 (true);%0A%09%09Gdx.gl
-20
 .glColorMask(fal
@@ -559,34 +559,32 @@
 ask() %7B%0A%09%09Gdx.gl
-20
 .glDepthMask(fal
@@ -596,18 +596,16 @@
 %09%09Gdx.gl
-20
 .glColor
@@ -643,18 +643,16 @@
 %09%09Gdx.gl
-20
 .glEnabl
@@ -679,26 +679,24 @@
 );%0A%0A%09%09Gdx.gl
-20
 .glDepthFunc
@@ -804,18 +804,16 @@
 %09%09Gdx.gl
-20
 .glDisab

Refactor to use gdx GL instead of GL20