JCGLTextureUpdates.newUpdateReplacingAll2D(ta); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) { JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) { JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) {
@Test public final void testLoadTextureIOError() throws Exception { final JCGLAsyncResourceLoaderType loader = this.getLoader("main"); final CompletableFuture<JCGLTexture2DType> f = loader.loadTexture( () -> { throw new UncheckedIOException(new IOException("IO failure")); }, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST, (tex, data) -> JCGLTextureUpdates.newUpdateReplacingAll2D(tex) ); this.expected.expect(ExecutionException.class); this.expected.expectMessage("IO failure"); f.get(30L, TimeUnit.SECONDS); }
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.data(); Assert.assertEquals(512L * 512L * 2L, (long) data.capacity());
/** * Create a new update that will replace the entirety of {@code t}. * * @param t The texture * * @return A new update */ public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t); return JCGLTextureUpdates.newUpdateReplacingArea2D(t, t.textureGetArea()); }
/** * Create a new update that will replace the entirety of one face of {@code * t}. * * @param t The texture * * @return A new update */ public static JCGLTextureCubeUpdateType newUpdateReplacingAllCube( final JCGLTextureCubeUsableType t) { NullCheck.notNull(t); return JCGLTextureUpdates.newUpdateReplacingAreaCube(t, t.textureGetArea()); }
@Test public final void testLoadTextureIOError() throws Exception { final JCGLAsyncResourceLoaderType loader = this.getLoader("main"); final CompletableFuture<JCGLTexture2DType> f = loader.loadTexture( () -> { throw new UncheckedIOException(new IOException("IO failure")); }, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST, (tex, data) -> JCGLTextureUpdates.newUpdateReplacingAll2D(tex) ); this.expected.expect(ExecutionException.class); this.expected.expectMessage("IO failure"); f.get(30L, TimeUnit.SECONDS); }
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.getData(); Assert.assertEquals(512L * 512L * 3L, (long) data.capacity());
/** * Create a new update that will replace the entirety of {@code t}. * * @param t The texture * * @return A new update */ public static JCGLTexture2DUpdateType newUpdateReplacingAll2D( final JCGLTexture2DUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingArea2D(t, AreaSizesL.area(t.size())); }
/** * Create a new update that will replace the entirety of one face of {@code * t}. * * @param t The texture * * @return A new update */ public static JCGLTextureCubeUpdateType newUpdateReplacingAllCube( final JCGLTextureCubeUsableType t) { NullCheck.notNull(t, "Texture"); return newUpdateReplacingAreaCube(t, AreaSizesL.area(t.size())); }
JCGLTextureUpdates.newUpdateReplacingAll2D(ta); final ByteBuffer data = up.data(); Assert.assertEquals(512L * 512L * 2L, (long) data.capacity()); JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
static JCGLTexture2DType newTexture2D( final JCGLInterfaceGL33Type g, final JCGLTextureFormat f, final int w, final int h, final JCGLTextureUnitType u) { final JCGLTexturesType gt = g.textures(); final JCGLTexture2DType t = gt.texture2DAllocate( u, (long) w, (long) h, f, JCGLTextureWrapS.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); final JCGLTexture2DUpdateType up = JCGLTextureUpdates.newUpdateReplacingAll2D(t); final ByteBuffer data = up.data(); for (int index = 0; index < data.capacity(); ++index) { data.put(index, (byte) 0); } gt.texture2DUpdate(u, up); gt.textureUnitUnbind(u); return t; } }
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.data(); Assert.assertEquals(512L * 512L * 2L, (long) data.capacity()); JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 2L, (long) data.capacity());
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) {
@Test public final void testTexture2DUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u, 128L, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingArea2D( ta, AreasL.create(0L, 0L, 513L, 513L)); }
@Test public final void testTextureCubeUpdateAreaNonInclusive() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 128L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); this.expected.expect(RangeCheckException.class); JCGLTextureUpdates.newUpdateReplacingAreaCube( ta, AreasL.create(0L, 0L, 513L, 513L)); }
JCGLTextureUpdates.newUpdateReplacingAll2D(ta); final ByteBuffer data = up.data(); Assert.assertEquals(512L * 512L * 3L, (long) data.capacity()); JCGLTextureUpdates.newUpdateReplacingArea2D(ta, area); final ByteBuffer data = up.data(); Assert.assertEquals(128L * 128L * 3L, (long) data.capacity());
static JCGLTexture2DType newTexture2D( final JCGLInterfaceGL33Type g, final JCGLTextureFormat f, final int w, final int h, final JCGLTextureUnitType u) { final JCGLTexturesType gt = g.getTextures(); final JCGLTexture2DType t = gt.texture2DAllocate( u, (long) w, (long) h, f, JCGLTextureWrapS.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); final JCGLTexture2DUpdateType up = JCGLTextureUpdates.newUpdateReplacingAll2D(t); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) { data.put(index, (byte) 0); } gt.texture2DUpdate(u, up); gt.textureUnitUnbind(u); return t; } }
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) { JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, area); final ByteBuffer data = up.getData(); for (int index = 0; index < data.capacity(); ++index) {
JCGLTextureUpdates.newUpdateReplacingAllCube(ta); final ByteBuffer data = up.data(); Assert.assertEquals(512L * 512L * 4L, (long) data.capacity());