diff --git a/src/main/java/bvv/core/cache/TextureCache.java b/src/main/java/bvv/core/cache/TextureCache.java index c8f36d0..172f04c 100644 --- a/src/main/java/bvv/core/cache/TextureCache.java +++ b/src/main/java/bvv/core/cache/TextureCache.java @@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger; import net.imglib2.util.Intervals; import bvv.core.backend.Texture3D; +import bvv.core.backend.Texture.InternalFormat; import bvv.core.blocks.ByteUtils; import static bvv.core.cache.TextureCache.ContentState.INCOMPLETE; @@ -301,10 +302,20 @@ private void initializeBlockedTiles( ArrayList< TileFillTask > tileFillTasks ) final Object dummyImage = new Object(); final ImageBlockKey< Object > oobDummyKey = new ImageBlockKey<>( dummyImage, new int[] { 0, 0, 0 } ); final int elementsPerTile = ( int ) Intervals.numElements( spec.paddedBlockSize() ); - tileFillTasks.add( new TileFillTask( new DefaultFillTask( oobDummyKey, buf -> { - ByteUtils.setShorts( ( short ) 0, buf.getAddress(), elementsPerTile ); - return true; - } , () -> true ), oobTile ) ); + if(spec.format() == InternalFormat.R8) + { + tileFillTasks.add( new TileFillTask( new DefaultFillTask( oobDummyKey, buf -> { + ByteUtils.setBytes( ( byte ) 0, buf.getAddress(), elementsPerTile ); + return true; + } , () -> true ), oobTile ) ); + } + if(spec.format() == InternalFormat.R16) + { + tileFillTasks.add( new TileFillTask( new DefaultFillTask( oobDummyKey, buf -> { + ByteUtils.setShorts( ( short ) 0, buf.getAddress(), elementsPerTile ); + return true; + } , () -> true ), oobTile ) ); + } } private List< Tile > assignFillTiles( final int size, final int currentTimestamp )