aboutsummaryrefslogtreecommitdiffstats
path: root/src/ru/olamedia/asset/Shader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ru/olamedia/asset/Shader.java')
-rw-r--r--src/ru/olamedia/asset/Shader.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ru/olamedia/asset/Shader.java b/src/ru/olamedia/asset/Shader.java
index 8fd9ada..bd19556 100644
--- a/src/ru/olamedia/asset/Shader.java
+++ b/src/ru/olamedia/asset/Shader.java
@@ -31,10 +31,20 @@ public class Shader {
public void enable() {
GL2ES2 gl = GLContext.getCurrentGL().getGL2ES2();
state.useProgram(gl, true);
+ gl.getContext().attachObject(Shader.class.getName(), state);
}
public void disable() {
GL2ES2 gl = GLContext.getCurrentGL().getGL2ES2();
state.useProgram(gl, false);
}
+
+ public static ShaderState getCurrentShaderState() {
+ final GLContext ctx = GLContext.getCurrent();
+ if(null != ctx) {
+ return (ShaderState) ctx.getAttachedObject(Shader.class.getName());
+ } else {
+ return null;
+ }
+ }
}