@Override
  protected final void doRender(DrawContext dc) {
    if (this.forceLevelZeroLoads && !this.levelZeroLoaded) this.loadAllTopLevelTextures(dc);
    if (dc.getSurfaceGeometry() == null || dc.getSurfaceGeometry().size() < 1) return;

    dc.getGeographicSurfaceTileRenderer().setShowImageTileOutlines(this.showImageTileOutlines);

    draw(dc);
  }
  private void draw(DrawContext dc) {
    this.referencePoint = this.computeReferencePoint(dc);

    this.assembleTiles(dc); // Determine the tiles to draw.

    if (this.currentTiles.size() >= 1) {
      MercatorTextureTile[] sortedTiles = new MercatorTextureTile[this.currentTiles.size()];
      sortedTiles = this.currentTiles.toArray(sortedTiles);
      Arrays.sort(sortedTiles, levelComparer);

      GL gl = dc.getGL();

      if (this.isUseTransparentTextures() || this.getOpacity() < 1) {
        gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL.GL_POLYGON_BIT | GL.GL_CURRENT_BIT);
        gl.glColor4d(1d, 1d, 1d, this.getOpacity());
        gl.glEnable(GL.GL_BLEND);
        gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
      } else {
        gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL.GL_POLYGON_BIT);
      }

      gl.glPolygonMode(GL.GL_FRONT, GL.GL_FILL);
      gl.glEnable(GL.GL_CULL_FACE);
      gl.glCullFace(GL.GL_BACK);

      dc.setPerFrameStatistic(
          PerformanceStatistic.IMAGE_TILE_COUNT, this.tileCountName, this.currentTiles.size());
      dc.getGeographicSurfaceTileRenderer().renderTiles(dc, this.currentTiles);

      gl.glPopAttrib();

      if (this.drawTileIDs) this.drawTileIDs(dc, this.currentTiles);

      if (this.drawBoundingVolumes) this.drawBoundingVolumes(dc, this.currentTiles);

      this.currentTiles.clear();
    }

    this.sendRequests();
    this.requestQ.clear();
  }