Exemplo n.º 1
0
 public void dispose(GLAutoDrawable drawable) {
   GL2 gl = drawable.getGL().getGL2();
   if (null != texture) {
     texture.disable();
     texture.destroy(gl);
   }
   if (null != textureData) {
     textureData.destroy();
   }
 }
Exemplo n.º 2
0
  @Override
  public void dispose(final GLAutoDrawable drawable) {
    final GL2ES2 gl = drawable.getGL().getGL2ES2();
    if (null != texture) {
      texture.disable(gl);
      texture.destroy(gl);
    }
    if (null != textureData) {
      textureData.destroy();
    }

    pmvMatrixUniform = null;
    pmvMatrix = null;
    st.destroy(gl);
    st = null;
  }
Exemplo n.º 3
0
  /**
   * @param buffer
   * @param tile
   * @param pool
   * @return
   */
  private Tile createTile(
      FloatBuffer buffer,
      Rectangle tile,
      GL gl,
      Deque<Texture> pool,
      TablePerspective tablePerspective) {
    final VirtualArray recordVA = tablePerspective.getRecordPerspective().getVirtualArray();
    final VirtualArray dimVA = tablePerspective.getDimensionPerspective().getVirtualArray();
    final ATableBasedDataDomain dataDomain = tablePerspective.getDataDomain();
    final int ilast = tile.y + tile.height;
    final int jlast = tile.x + tile.width;

    // fill buffer
    buffer.rewind();
    for (int i = tile.y; i < ilast; ++i) {
      int recordID = recordVA.get(i);
      for (int j = tile.x; j < jlast; ++j) {
        int dimensionID = dimVA.get(j);
        Color color = blockColorer.apply(recordID, dimensionID, dataDomain, false);
        buffer.put(color.getRGBA());
      }
    }

    // load to texture
    buffer.rewind();
    Texture texture;
    if (!pool.isEmpty()) texture = pool.poll();
    else texture = TextureIO.newTexture(GL.GL_TEXTURE_2D);

    TextureData texData = asTextureData(buffer, tile.width, tile.height);
    texture.updateImage(gl, texData);
    gl.glFlush();
    texData.destroy();

    return new Tile(tile, texture);
  }