Beispiel #1
0
 public static void checkerr(GL gl) {
   int err = gl.glGetError();
   if (err != 0) {
     System.out.println("Checkerr error: " + err);
     throw (new GLException(err));
   }
 }
Beispiel #2
0
 private void checkGLErrors(GL gl) {
   int err = gl.glGetError();
   if (err != 0) {
     String errString = glu.gluErrorString(err);
     System.out.println(errString);
   }
 }
  /**
   * Queries OpenGL for errors in the vertex program. Errors are logged as SEVERE, noting both the
   * line number and message.
   */
  private static void checkProgramError() {
    final GL gl = GLU.getCurrentGL();

    if (gl.glGetError() == GL.GL_INVALID_OPERATION) {
      // retrieve the error position
      final IntBuffer errorloc = BufferUtils.createIntBuffer(16);
      gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); // TODO Check for integer

      logger.severe(
          "Error "
              + gl.glGetString(GL.GL_PROGRAM_ERROR_STRING_ARB)
              + " in vertex program on line "
              + errorloc.get(0));
    }
  }
Beispiel #4
0
  public void init(final GLAutoDrawable drawable) {
    GL _gl = drawable.getGL();

    _gl.glGetError(); // flush error ..

    if (glDebug) {
      try {
        _gl =
            _gl.getContext()
                .setGL(GLPipelineFactory.create("javax.media.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(
                        "javax.media.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("---------------------------");
  }
Beispiel #5
0
 public static void checkerr(GL gl) {
   int err = gl.glGetError();
   if (err != 0) throw (glexcfor(err));
 }