Share error code to string of jgl

This commit is contained in:
Martin Pernollet 2022-03-17 10:35:01 +01:00
parent 260480beb9
commit 7de96cc620
2 changed files with 37 additions and 32 deletions

View File

@ -122,8 +122,22 @@ public abstract class gl_object {
public void gl_error(int error, String s) {
if (debug) {
StringBuffer sb = errorCodeToString("jGL Error (", error, "): " + s);
if (throwExceptionOnGLError) {
throw new RuntimeException(sb.toString());
} else {
System.err.println(sb.toString());
}
}
if (ErrorValue == GL.GL_NO_ERROR) {
ErrorValue = error;
}
}
public static StringBuffer errorCodeToString(String prefix, int error, String suffix) {
StringBuffer sb = new StringBuffer();
sb.append("jGL Error (");
sb.append(prefix);
switch (error) {
case GL.GL_NO_ERROR:
@ -152,17 +166,8 @@ public abstract class gl_object {
break;
}
// System.out.println("): " + s);
sb.append("): " + s);
if (throwExceptionOnGLError) {
throw new RuntimeException(sb.toString());
} else {
System.err.println(sb.toString());
}
}
if (ErrorValue == GL.GL_NO_ERROR) {
ErrorValue = error;
}
sb.append(suffix);
return sb;
}
public void setThrowExceptionOnGLError(boolean status) {

View File

@ -19,7 +19,7 @@ import org.jzy3d.plot3d.rendering.view.View;
public class ITTest_AxisLabelRotateLayout extends ITTest{
public static void main(String[] args) {
open(new ITTest_AxisLabelRotateLayout().whenAxisLabelOrientationNotHorizontal(WT.Native_AWT, HiDPI.OFF));
open(new ITTest_AxisLabelRotateLayout().whenAxisLabelOrientationNotHorizontal(WT.Native_AWT, HiDPI.ON));
}
@Test