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 DebugGL2((GL2)drawable.getContext().getGL()), traceLevel));
}
if(!(drawable.getGL() instanceof TraceGL)) {
drawable.setGL(new TraceGL(new DebugGL2((GL2)drawable.getGL()), traceLevel));
}
} else {
if(!(drawable.getContext().getGL() instanceof TraceGL)) {
drawable.getContext().setGL(new TraceGL((GL2)drawable.getContext().getGL(), traceLevel));
}
if(!(drawable.getGL() instanceof TraceGL)) {
drawable.setGL(new TraceGL((GL2)drawable.getGL(), traceLevel));
}
}
} else if(debugGL) {
if(!(drawable.getContext().getGL() instanceof DebugGL2)) {
drawable.getContext().setGL(new DebugGL2((GL2)drawable.getContext().getGL()));
}
if(!(drawable.getGL() instanceof DebugGL2)) {
drawable.setGL(new DebugGL2((GL2)drawable.getGL()));
}
}
}