diff options
author | Sven Gothel <[email protected]> | 2012-12-23 13:53:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-12-23 13:53:36 +0100 |
commit | 7cf2ca62bed2a8a9541f09a72d8a26e4f1203de2 (patch) | |
tree | 72b37e9a58bee51ba9be3cb8d4b85b722f476161 /src/ru/olamedia/asset | |
parent | 4bd8df723573250f11afb7b67c7235f8dc8b631e (diff) |
Shader: Add 'current' ShaderState setting via GLContext attachement (removed from latest JOGL); Associate created GLArrayDataServer w/ current ShaderState; Add notes re: GL2.GL_QUADS
Diffstat (limited to 'src/ru/olamedia/asset')
-rw-r--r-- | src/ru/olamedia/asset/Shader.java | 10 |
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; + } + } } |