Ejemplo n.º 1
0
  /**
   * Creates a {@code Component} that is also a {@code GLAutoDrawable}. This is where all the
   * drawing takes place. The advantage of a {@code GLCanvas} is that it is faster, but a {@code
   * GLJPanel} is more portable. The component should also be disabled so that it does not receive
   * events that should be sent to the {@code drawableComponent}. A {@code GLCanvas} is a
   * heavyweight component and on some platforms will not pass through mouse events even though it
   * is disabled. A {@code GLJPanel} supports this better.
   */
  protected GLAutoDrawable createGLComponent(
      GLCapabilitiesImmutable capabilities, GLContext shareWith) {
    GLCanvas canvas = new GLCanvas(capabilities);
    if (shareWith != null) {
      canvas.setSharedContext(shareWith);
    }

    canvas.setEnabled(false);
    chosenCapabilities = (GLCapabilitiesImmutable) capabilities.cloneMutable();
    return canvas;
  }