aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-28 08:12:26 +0200
committerSven Gothel <[email protected]>2011-04-28 08:12:26 +0200
commita66acbec16c339db66d5f9242f44b3b539808b99 (patch)
treebdbc522c74619bcb8accd0b8a70751350904ebd0 /src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
parentb7f5600f842e4e438eba51711b4aa9b23d5789bc (diff)
ShaderState Switch Program: Only disable current program if no new one; Better toString formating
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java25
1 files changed, 16 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 b622571e7..e04a8c534 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -30,6 +30,8 @@ package com.jogamp.opengl.util.glsl;
import javax.media.opengl.*;
+import com.jogamp.common.os.Platform;
+
import java.util.HashSet;
import java.util.Iterator;
import java.io.PrintStream;
@@ -262,18 +264,23 @@ public class ShaderProgram {
return id;
}
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("ShaderProgram[id="+id);
- buf.append(", linked="+programLinked+", inUse="+programInUse+", program: "+shaderProgram+", [");
+ public StringBuilder toString(StringBuilder sb) {
+ if(null == sb) {
+ sb = new StringBuilder();
+ }
+ sb.append("ShaderProgram[id=").append(id);
+ sb.append(", linked="+programLinked+", inUse="+programInUse+", program: "+shaderProgram+",");
for(Iterator<ShaderCode> iter=allShaderCode.iterator(); iter.hasNext(); ) {
- buf.append(iter.next());
- buf.append(" ");
+ sb.append(Platform.getNewline()).append(" ").append(iter.next());
}
- buf.append("]");
- return buf.toString();
+ sb.append("]");
+ return sb;
}
-
+
+ public String toString() {
+ return toString(null).toString();
+ }
+
protected synchronized void useProgram(GL2ES2 gl, boolean on) {
if(!programLinked) throw new GLException("Program is not linked");
if(programInUse==on) return;