protected void checkError(GL gl, String location) { int error = gl.glGetError(); if (error != GL_NO_ERROR) { String errorString; switch (error) { case GL_INVALID_ENUM: errorString = "GL_INVALID_ENUM"; break; case GL_INVALID_VALUE: errorString = "GL_INVALID_VALUE"; break; case GL_INVALID_OPERATION: errorString = "GL_INVALID_OPERATION"; break; case GL_INVALID_FRAMEBUFFER_OPERATION: errorString = "GL_INVALID_FRAMEBUFFER_OPERATION"; break; case GL_OUT_OF_MEMORY: errorString = "GL_OUT_OF_MEMORY"; break; default: errorString = "UNKNOWN"; break; } System.out.println("OpenGL Error(" + errorString + "): " + location); throw new Error(); } }
public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); _gl.glGetError(); // flush error .. if (glDebug) { try { _gl = _gl.getContext() .setGL(GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null)); } catch (final Exception e) { throw new RuntimeException("can not set debug pipeline", e); } } if (glTrace) { try { _gl = _gl.getContext() .setGL( GLPipelineFactory.create( "com.jogamp.opengl.Trace", null, _gl, new Object[] {System.err})); } catch (final Exception e) { throw new RuntimeException("can not set trace pipeline", e); } } System.out.println(_gl); _gl.getContext().setGLReadDrawable(externalRead); if (_gl.isGL2GL3()) { _gl.getGL2GL3().glReadBuffer(GL.GL_FRONT); } System.out.println("---------------------------"); System.out.println(_gl.getContext()); System.out.println("---------------------------"); }