diff options
author | Sven Gothel <[email protected]> | 2014-04-02 04:41:48 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-02 04:41:48 +0200 |
commit | e8a5a1cbb988670ca206ab1ac633e19a91bfa478 (patch) | |
tree | 5b9f17a06ad350150375a2a0e38daa3d6dd11251 /src/jogl/classes/com/jogamp/opengl/util/glsl | |
parent | 6f5686696b1e9085a759774056c7be9887a9e34f (diff) |
Bug 801: WIP 2/2 - Add color attribute; Switch Shader instead of branching in shader; Update attributes and uniforms manually, drop ShaderState;
- Due to shader-switching,
'renderModes' are now local to Region, e.g. UIShape etc
- Remove RegionRenderer.renderModes
- VBORegion2P*:
- Use simple 2x float matrix for orthogonal P+Mv
- Cleanup shader
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java | 17 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index b289b41e2..6a4b13dfb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -312,17 +312,20 @@ public class ShaderProgram { gl.glUseProgram( on ? shaderProgram : 0 ); programInUse = on; } + public synchronized void notifyNotInUse() { + programInUse = false; + } - protected boolean programLinked = false; - protected boolean programInUse = false; - protected int shaderProgram = 0; // non zero is valid! - protected HashSet<ShaderCode> allShaderCode = new HashSet<ShaderCode>(); - protected HashSet<ShaderCode> attachedShaderCode = new HashSet<ShaderCode>(); - protected int id = -1; + private boolean programLinked = false; + private boolean programInUse = false; + private int shaderProgram = 0; // non zero is valid! + private final HashSet<ShaderCode> allShaderCode = new HashSet<ShaderCode>(); + private final HashSet<ShaderCode> attachedShaderCode = new HashSet<ShaderCode>(); + private int id = -1; private static synchronized int getNextID() { return nextID++; } - protected static int nextID = 1; + private static int nextID = 1; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index ce4c2615d..64dd589b8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -176,8 +176,7 @@ public class ShaderState { } if(shaderProgram.inUse()) { if(null != prog && enable) { - // new program will issue glUseProgram(..) - shaderProgram.programInUse = false; + shaderProgram.notifyNotInUse(); } else { // no new 'enabled' program - disable useProgram(gl, false); |