final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u, 512L, data.put(index, (byte) 0xff); t.texture2DUpdate(u, up); final ByteBuffer data = t.texture2DGetImage(u, ta); Assert.assertEquals(512L * 512L, (long) data.capacity()); for (int index = 0; index < data.capacity(); ++index) {
final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); t.texture2DAllocate( u0, 128L, t.textureCubeAllocate( u0, 128L, t.textureUnitUnbind(u0); Assert.assertFalse(t.textureUnitIsBound(u0)); Assert.assertFalse(t.texture2DIsBound(u0, ta)); Assert.assertFalse(t.texture2DIsBoundAnywhere(ta)); Assert.assertFalse(t.textureCubeIsBound(u0, tb)); Assert.assertFalse(t.textureCubeIsBoundAnywhere(tb)); t.texture2DBind(u0, ta); Assert.assertTrue(t.textureUnitIsBound(u0)); Assert.assertTrue(t.texture2DIsBound(u0, ta)); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); Assert.assertFalse(t.textureCubeIsBound(u0, tb)); Assert.assertFalse(t.textureCubeIsBoundAnywhere(tb)); t.textureCubeBind(u0, tb); Assert.assertTrue(t.textureUnitIsBound(u0)); Assert.assertFalse(t.texture2DIsBound(u0, ta)); Assert.assertFalse(t.texture2DIsBoundAnywhere(ta));
@Test public final void testTexture2DDeleteUnbinds() { 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_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureUnitIsBound(u)); Assert.assertTrue(t.texture2DIsBound(u, ta)); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); t.texture2DDelete(ta); Assert.assertTrue(ta.isDeleted()); Assert.assertFalse(t.textureUnitIsBound(u)); }
@Test public final void testTexture2DRegenerateMipmapsOK() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType ta = t.texture2DAllocate( u0, 256L, 256L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.texture2DIsBoundAnywhere(ta)); t.texture2DRegenerateMipmaps(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 testTextureEmptyBindings() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); for (int index = 0; index < 16; ++index) { final JCGLTextureUnitType u = us.get(index); Assert.assertFalse(t.textureUnitIsBound(u)); } }
@Test public final void testFramebufferBindFeedbackTexture() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_DEPTH_16_2BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tx.textureUnitUnbind(u0); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferDrawBind(fb); this.expected.expect(JCGLExceptionFeedback.class); g_tx.texture2DBind(u0, t); }
final List<JCGLTextureUnitType> us = t.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureUnitType u1 = us.get(1); t.textureCubeAllocate( u0, 128L, JCGLTextureFilterMinification.TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); t.textureUnitUnbind(u0); Assert.assertFalse(t.textureCubeIsBoundAnywhere(ta)); Assert.assertFalse(t.textureCubeIsBound(u0, ta)); Assert.assertFalse(t.textureUnitIsBound(u0)); Assert.assertFalse(t.textureCubeIsBound(u1, ta)); Assert.assertFalse(t.textureUnitIsBound(u1)); t.textureCubeBind(u1, ta); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); Assert.assertFalse(t.textureCubeIsBound(u0, ta)); Assert.assertFalse(t.textureUnitIsBound(u0)); Assert.assertTrue(t.textureCubeIsBound(u1, ta)); Assert.assertTrue(t.textureUnitIsBound(u1)); t.textureCubeBind(u0, ta); Assert.assertTrue(t.textureCubeIsBoundAnywhere(ta)); Assert.assertTrue(t.textureCubeIsBound(u0, ta));
@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)); }
private static JCGLFramebufferType depthlessFramebuffer( final JCGLFramebuffersType g_fb, final JCGLTexturesType g_tex) { final JCGLTextureUnitType u0 = g_tex.textureGetUnits().get(0); final JCGLTexture2DType t = g_tex.texture2DAllocate( u0, 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); g_tex.textureUnitUnbind(u0); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); fbb.attachColorTexture2DAt( g_fb.framebufferGetColorAttachments().get(0), g_fb.framebufferGetDrawBuffers().get(0), t); return g_fb.framebufferAllocate(fbb); }
final List<JCGLTextureUnitType> us = t.textureGetUnits(); t.texture2DAllocate( us.get(0), 128L, t.textureUnitUnbind(u); Assert.assertFalse(t.textureUnitIsBound(ku)); Assert.assertFalse(t.texture2DIsBound(ku, ta)); t.texture2DBind(u, ta); Assert.assertTrue(t.textureUnitIsBound(ku)); Assert.assertTrue(t.texture2DIsBound(ku, ta)); } else { Assert.assertFalse(t.textureUnitIsBound(ku)); Assert.assertFalse(t.texture2DIsBound(ku, ta)); t.texture2DBind(u, ta); Assert.assertTrue(t.textureUnitIsBound(ku)); Assert.assertTrue(t.texture2DIsBound(ku, ta)); } else { Assert.assertFalse(t.textureUnitIsBound(ku)); Assert.assertFalse(t.texture2DIsBound(ku, ta)); t.textureUnitUnbind(u);
td -> this.g.evaluate((g33, unused) -> { final JCGLTexturesType gt = g33.textures(); final List<JCGLTextureUnitType> us = gt.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); final long w = td.width(); final long h = td.height(); return gt.texture2DAllocate( u0, w, h, format, wrap_s, wrap_t, min_filter, mag_filter); })); final List<JCGLTextureUnitType> us = gt.textureGetUnits(); final JCGLTextureUnitType u0 = us.get(0); gt.texture2DBind(u0, up.texture()); gt.texture2DUpdate(u0, up); return (JCGLTexture2DType) up.texture(); }));
private static JCGLTexture2DType newProjectionTexture( final JCGLInterfaceGL33Type c) { final JCGLTexturesType gt = c.getTextures(); final List<JCGLTextureUnitType> gu = gt.textureGetUnits(); return gt.texture2DAllocate( gu.get(0), 64L, 64L, JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, JCGLTextureWrapS.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureWrapT.TEXTURE_WRAP_CLAMP_TO_EDGE, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_LINEAR); }
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; } }
final List<JCGLTextureUnitType> units = g_tex.textureGetUnits(); final JCGLTextureUnitType u0 = units.get(0); data.put(index, (byte) random.nextInt(0xff)); g_tex.texture2DUpdate(u0, this.texture_update);
final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); final JCGLTextureCubeType t1 = JCGLTextureUnitAllocatorContract.newTextureCube(g_tx, u0); g_tx.textureUnitUnbind(u0); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); Assert.assertTrue(g_tx.textureUnitIsBound(us.get(index))); for (int index = 4; index < 8; ++index) { final JCGLTextureUnitType ru = c_1.unitContextBindTextureCube(g_tx, rt1); Assert.assertTrue(g_tx.textureUnitIsBound(us.get(index))); g_tx.textureCubeDelete(t0); c_1.unitContextFinish(g_tx); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index)));
final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); final JCGLTexture2DType t1 = JCGLTextureUnitAllocatorContract.newTexture(g_tx, u0); g_tx.textureUnitUnbind(u0); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); Assert.assertTrue(g_tx.textureUnitIsBound(us.get(index))); for (int index = 4; index < 8; ++index) { final JCGLTextureUnitType ru = c_1.unitContextBindTexture2D(g_tx, rt1); Assert.assertTrue(g_tx.textureUnitIsBound(us.get(index))); g_tx.texture2DDelete(t0); c_1.unitContextFinish(g_tx); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index))); Assert.assertFalse(g_tx.textureUnitIsBound(us.get(index)));
@Test public final void testBindError2D() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.getTextures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTexture2DType t0 = JCGLTextureUnitAllocatorContract.newTexture(g_tx, u0); g_tx.textureUnitUnbind(u0); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextBindTexture2D(g_tx, t0); }
@Test public final void testTextureUnits() { final JCGLTexturesType t = this.getTextures("main"); final List<JCGLTextureUnitType> us = t.textureGetUnits(); for (int index = 0; index < 16; ++index) { final JCGLTextureUnitType u = us.get(index); Assert.assertEquals((long) index, (long) u.index()); } }
Integer.valueOf(this.unit.unitGetIndex())); g.textureUnitUnbind(this.unit); } else { if (t.isDeleted()) { Integer.valueOf(this.unit.unitGetIndex())); g.textureUnitUnbind(this.unit); this.bindings[index] = null; } else { if (t instanceof JCGLTexture2DUsableType) { this.g3.texture2DBind(this.unit, (JCGLTexture2DUsableType) t); } else if (t instanceof JCGLTextureCubeUsableType) { this.g3.textureCubeBind(this.unit, (JCGLTextureCubeUsableType) t); } else { throw new UnimplementedCodeException();