private static JCGLTextureCubeType newTextureCube( final JCGLTexturesType g_tx, final JCGLTextureUnitType u0) { return g_tx.textureCubeAllocate( u0, 2L, 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); }
private static JCGLTextureCubeType newTextureCube( final JCGLTexturesType g_tx, final JCGLTextureUnitType u0) { return g_tx.textureCubeAllocate( u0, 2L, 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); }
@Test public final void testTextureCubeRegenerateMipmapsOK() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeRegenerateMipmaps(u0); }
@Test public final void testTextureCubeRegenerateMipmapsNoOp() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, 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); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeRegenerateMipmaps(u0); }
@Test public final void testTextureCubeRegenerateMipmapsOK() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeRegenerateMipmaps(u0); }
@Test public final void testTextureCubeRegenerateMipmapsNoOp() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, 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); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeRegenerateMipmaps(u0); }
final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 512L,
@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)); }
@Test public final void testTextureCubeRegenerateMipmapsUnbound() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureUnitUnbind(u0); this.expected.expect(JCGLExceptionTextureNotBound.class); t.textureCubeRegenerateMipmaps(u0); } }
@Test public final void testTextureCubeSizeSmall() throws Exception { final JCGLTexturesType t = this.getTextures("main"); final JCGLTLTextureUpdateProviderType up = this.getUpdateProvider(); final JCGLTLTextureDataProviderType dp = this.getDataProvider(); final List<JCGLTextureUnitType> units = t.textureGetUnits(); final JCGLTLTextureDataType data = dp.loadFromStream( JCGLTLTextureUpdateProviderContract.class.getResourceAsStream( "basn6a08.png")); final JCGLTextureCubeType tt = t.textureCubeAllocate( units.get(0), 8L, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); this.expected.expect(RangeCheckException.class); this.expected.expectMessage(new StringContains("Texture size")); up.getTextureUpdateCube(tt, data); }
@Test public final void testTextureCubeRegenerateMipmapsUnbound() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u0, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureUnitUnbind(u0); this.expected.expect(JCGLExceptionTextureNotBound.class); t.textureCubeRegenerateMipmaps(u0); } }
@Test public final void testTextureCubeSizeSmall() throws Exception { final JCGLTexturesType t = this.getTextures("main"); final JCGLTLTextureUpdateProviderType up = this.getUpdateProvider(); final JCGLTLTextureDataProviderType dp = this.getDataProvider(); final List<JCGLTextureUnitType> units = t.textureGetUnits(); final JCGLTLTextureDataType data = dp.loadFromStream( JCGLTLTextureUpdateProviderContract.class.getResourceAsStream( "basn6a08.png")); final JCGLTextureCubeType tt = t.textureCubeAllocate( units.get(0), 8L, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); this.expected.expect(RangeCheckException.class); this.expected.expectMessage(new StringContains("Texture size")); up.createTextureUpdateCube(tt, data); }
@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, AreaInclusiveUnsignedL.of( new UnsignedRangeInclusiveL(0L, 512L), new UnsignedRangeInclusiveL(0L, 512L))); }
@Test public final void testTextureCubeUpdateAreaIdentities() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 512L, JCGLTextureFormat.TEXTURE_FORMAT_R_8_1BPP, JCGLTextureWrapR.TEXTURE_WRAP_REPEAT, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); final AreaL expected_area = AreasL.create(128L, 128L, 128L, 128L); final JCGLTextureCubeUpdateType up = JCGLTextureUpdates.newUpdateReplacingAreaCube(ta, expected_area); Assert.assertEquals(ta, up.texture()); Assert.assertEquals(expected_area, up.area()); final ByteBuffer data = up.data(); final long expected_size = 128L * 128L; Assert.assertEquals(expected_size, (long) data.capacity()); final UnsignedRangeInclusiveL expected_range = new UnsignedRangeInclusiveL(0L, expected_size - 1L); Assert.assertEquals(expected_range, up.dataUpdateRange()); }
@Test public final void testTextureCubeUpdateAllIdentities() { 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); final JCGLTextureCubeUpdateType up = JCGLTextureUpdates.newUpdateReplacingAllCube(ta); Assert.assertEquals(ta, up.texture()); final AreaL expected_area = AreasL.create(0L, 0L, 128L, 128L); Assert.assertEquals(expected_area, up.area()); final ByteBuffer data = up.data(); final long expected_size = 128L * 128L * 4L; Assert.assertEquals(expected_size, (long) data.capacity()); final UnsignedRangeInclusiveL expected_range = new UnsignedRangeInclusiveL(0L, expected_size - 1L); Assert.assertEquals(expected_range, up.dataUpdateRange()); }
final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 128L,
final JCGLTextureUnitType u = us.get(0); final JCGLTextureCubeType ta = t.textureCubeAllocate( u, 512L,
@Test public final void testTextureCubeDeleteUnbinds() { 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_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureUnitIsBound(u)); Assert.assertTrue(t.textureCubeIsBound(u, ta)); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeDelete(ta); Assert.assertTrue(ta.isDeleted()); Assert.assertFalse(t.textureUnitIsBound(u)); }
@Test public final void testTextureCubeDeleteUnbinds() { 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_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureUnitIsBound(u)); Assert.assertTrue(t.textureCubeIsBound(u, ta)); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureCubeDelete(ta); Assert.assertTrue(ta.isDeleted()); Assert.assertFalse(t.textureUnitIsBound(u)); }