protected void debug(GLAutoDrawable drawable) {
// Install debugging and tracing in the GL pipeline
if(trace) {
if(debugGL) {
if(!(drawable.getContext().getGL() instanceof TraceGL)) {
drawable.getContext().setGL(new TraceGL(new DebugGL(drawable.getContext().getGL()), traceLevel));
}
if(!(drawable.getGL() instanceof TraceGL)) {
drawable.setGL(new TraceGL(new DebugGL(drawable.getGL()), traceLevel));
}
} else {
if(!(drawable.getContext().getGL() instanceof TraceGL)) {
drawable.getContext().setGL(new TraceGL(drawable.getContext().getGL(), traceLevel));
}
if(!(drawable.getGL() instanceof TraceGL)) {
drawable.setGL(new TraceGL(drawable.getGL(), traceLevel));
}
}
} else if(debugGL) {
if(!(drawable.getContext().getGL() instanceof DebugGL)) {
drawable.getContext().setGL(new DebugGL(drawable.getContext().getGL()));
}
if(!(drawable.getGL() instanceof DebugGL)) {
drawable.setGL(new DebugGL(drawable.getGL()));
}
}
}