repainting speed

The jogl user’s guide suggests using GLDrawable.display() to cause a repaint. I find that calling the repaint method on my GLCanvas, e.g. glCanvas.repaint(), actually runs must faster.

Why is this?

There is no apparent reason why this would be the case. GLDrawable is an interface which is implemented by GLCanvas. I see every reason for the inverse to be true. Calling display causes


  public void display() {
    displayImpl();
  }

to be called which is basically passing the painting off to the native rendering implementation.

However calling repaint would be calling paint which would be calling


  /** Overridden from Canvas; calls {@link #display}. Should not be
      invoked by applications directly. */
  public void paint(Graphics g) {
    if (!context.getNoAutoRedrawMode()) {
      display();
    }
  }

So unless yoru context isn’t redrawing itself automatically which could lead to some weirdness when windows overlap and such, at worst they should be the same speed with a call to display being faster (and correct).

All of the code for this is is in GLCanvas.java if you want to check things out yourself.