@Test public final void testIdentities() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g = c.contextGetGL33(); final JCGLTextureUnitAllocatorType a = JCGLTextureUnitAllocator.newAllocatorWithStack(4, g.getTextures().textureGetUnits()); final AreaInclusiveUnsignedL area = AreaInclusiveUnsignedL.of( new UnsignedRangeInclusiveL(0L, 639L), new UnsignedRangeInclusiveL(0L, 479L)); final R2ImageBufferDescription desc = R2ImageBufferDescription.of(area, Optional.empty()); final R2ImageBufferType gb = R2ImageBuffer.newImageBuffer( g.getFramebuffers(), g.getTextures(), a.getRootContext(), desc); Assert.assertEquals(640L * 480L * 4L, gb.getRange().getInterval()); Assert.assertFalse(gb.isDeleted()); final R2Texture2DUsableType t_rgba = gb.getRGBATexture(); final JCGLFramebufferUsableType fb = gb.getPrimaryFramebuffer(); Assert.assertEquals(desc, gb.getDescription()); Assert.assertEquals(area, gb.getArea()); Assert.assertEquals( JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, t_rgba.get().textureGetFormat()); gb.delete(g); Assert.assertTrue(fb.isDeleted()); Assert.assertTrue(gb.isDeleted()); }
@Override public void onReceiveShadowMap( final JCGLTexturesType g_tex, final JCGLShadersType g_sh, final JCGLTextureUnitContextMutableType tc, final R2Texture2DUsableType map) { NullCheck.notNull(g_tex); NullCheck.notNull(g_sh); NullCheck.notNull(tc); NullCheck.notNull(map); this.unit_shadow = tc.unitContextBindTexture2D(g_tex, map.get()); g_sh.shaderUniformPutTexture2DUnit(this.u_shadow_map, this.unit_shadow); }
@Test public final void testIdentitiesWithDepth() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g = c.contextGetGL33(); final JCGLTextureUnitAllocatorType a = JCGLTextureUnitAllocator.newAllocatorWithStack(4, g.getTextures().textureGetUnits()); for (final R2DepthPrecision dp : R2DepthPrecision.values()) { final AreaInclusiveUnsignedL area = AreaInclusiveUnsignedL.of( new UnsignedRangeInclusiveL(0L, 639L), new UnsignedRangeInclusiveL(0L, 479L)); final R2ImageBufferDescription desc = R2ImageBufferDescription.of(area, Optional.of(dp)); final R2ImageBufferType gb = R2ImageBuffer.newImageBuffer( g.getFramebuffers(), g.getTextures(), a.getRootContext(), desc); long pixel_size = 4L; switch (dp) { case R2_DEPTH_PRECISION_16: pixel_size += 2L; break; case R2_DEPTH_PRECISION_24: pixel_size += 4L; break; case R2_DEPTH_PRECISION_32F: pixel_size += 4L; break; } Assert.assertEquals(640L * 480L * pixel_size, gb.getRange().getInterval()); Assert.assertFalse(gb.isDeleted()); final R2Texture2DUsableType t_rgba = gb.getRGBATexture(); final JCGLFramebufferUsableType fb = gb.getPrimaryFramebuffer(); Assert.assertEquals(desc, gb.getDescription()); Assert.assertEquals(area, gb.getArea()); Assert.assertEquals( JCGLTextureFormat.TEXTURE_FORMAT_RGBA_8_4BPP, t_rgba.get().textureGetFormat()); gb.delete(g); Assert.assertTrue(fb.isDeleted()); Assert.assertTrue(gb.isDeleted()); } }