protected void transformBackgroundImageCoordsToAnnotationCoords(
      DrawContext dc, int width, int height, WWTexture texture) {
    GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

    // Scale background image coordinates to fit the Annotation's dimensions.
    java.awt.Dimension size = this.getImageSize(dc);
    if (size != null) {
      gl.glScaled(size.getWidth() / (double) width, size.getHeight() / (double) height, 1d);
    }

    super.transformBackgroundImageCoordsToAnnotationCoords(dc, width, height, texture);
  }
  protected void applyBackgroundTextureState(
      DrawContext dc, int width, int height, double opacity, WWTexture texture) {
    super.applyBackgroundTextureState(dc, width, height, opacity, texture);

    // Setup the texture filters to correspond to the smoothing and mipmap settings.
    int minFilter =
        this.isEnableSmoothing()
            ? (this.isUseMipmaps() ? GL.GL_LINEAR_MIPMAP_LINEAR : GL.GL_LINEAR)
            : GL.GL_NEAREST;
    int magFilter = this.isEnableSmoothing() ? GL.GL_LINEAR : GL.GL_NEAREST;

    GL gl = dc.getGL();
    gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, minFilter);
    gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, magFilter);
  }