/** * Enable the given fragment texture. * * @param fragmentTexture * @param gl * context to which the given textures are bound. */ public void enable( FragmentTexture fragmentTexture, GL gl ) { if ( fragmentTexture.cachingEnabled() ) { FragmentTexture inCache = get( fragmentTexture.getId() ); if ( inCache == null ) { this.put( fragmentTexture.getId(), fragmentTexture ); } } if ( !fragmentTexture.isEnabled() ) { fragmentTexture.enable( gl ); } }
/** * @param gl * context to which the textures were bound. * */ public void cleanUp( GL gl ) { // should only be called after a render cycle. LOG.debug( "Cleaning up {} number of LRU marked textures from gpu. Cache currently holds: {} textures ", markedAsRemoved.size(), this.size() ); for ( FragmentTexture ft : markedAsRemoved ) { if ( ft != null ) { remove( ft.getId() ); if ( values().contains( ft ) ) { LOG.warn( "Although removed, the give texture ({}) is still in the cache, this is strange.", ft ); } ft.disable( gl ); ft.unload(); // remove( ft ); } } markedAsRemoved.clear(); LOG.debug( "After clean up, gpu cache still holds: {} textures ", this.size() ); }
FragmentTexture texture = new FragmentTexture( request.getFragment(), tile ); int id = texture.getId(); FragmentTexture gpuTex = gpuCache.get( id ); if ( gpuTex != null && tileRequest.isFullfilled( gpuTex.getTextureTile() ) ) {