diff options
author | Harvey Harrison <[email protected]> | 2013-10-22 22:50:42 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-10-22 22:50:42 -0700 |
commit | fa865a86033f64309b777dec7f557376f7f0eb46 (patch) | |
tree | 580593ab35d7a00b7113a8681e96d118899cb27b | |
parent | 7fd9174afe73ae2a61af9a6d101afb7f21bb608b (diff) |
jogl: pass format and arguments directly to the printGLError function
This saves us a bit more code size as the String.format is now in the common
helper rather than in every GL wrapper function.
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index a84869756..a51151b82 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -933,10 +933,13 @@ public class BuildComposablePipeline { output.format(" return %s.glGetError();%n", getDownstreamObjectName()); output.println(" }"); - output.println(" private void writeGLError(int err, String caller)"); + output.println(" private void writeGLError(int err, String fmt, Object... args)"); output.println(" {"); - output.println(" StringBuilder buf = new StringBuilder(Thread.currentThread()+"); - output.println(" \" glGetError() returned the following error codes after a call to \" + caller + \": \");"); + output.println(" StringBuilder buf = new StringBuilder();"); + output.println(" buf.append(Thread.currentThread().toString());"); + output.println(" buf.append(\" glGetError() returned the following error codes after a call to \");"); + output.println(" buf.append(String.format(fmt, args));"); + output.println(" buf.append(\": \");"); output.println(); output.println(" // Loop repeatedly to allow for distributed GL implementations,"); output.println(" // as detailed in the glGetError() specification"); @@ -1026,8 +1029,8 @@ public class BuildComposablePipeline { StringBuilder fmtsb = new StringBuilder(); StringBuilder argsb = new StringBuilder(); - fmtsb.append(" String txt = String.format(\"%s("); - argsb.append(" \"").append(m.getName()).append("\""); + fmtsb.append("\"%s("); + argsb.append("\"").append(m.getName()).append("\""); Class<?>[] params = m.getParameterTypes(); for (int i = 0; i < params.length; i++) { if (i > 0) { @@ -1047,10 +1050,11 @@ public class BuildComposablePipeline { fmtsb.append(")\","); argsb.append(");"); + // calls to glGetError() are only allowed outside of glBegin/glEnd pairs + output.print(" writeGLError(err, "); output.println(fmtsb.toString()); + output.print(" "); output.println(argsb.toString()); - // calls to glGetError() are only allowed outside of glBegin/glEnd pairs - output.println(" writeGLError( err, txt );"); output.println(" }"); } } |