final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertEquals(Optional.empty(), g_fb.framebufferReadGetBound()); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); g_fb.framebufferDrawBind(fb); g_fb.framebufferReadBind(fb); g_fb.framebufferBlit( area, area,
final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadBind(fb); Assert.assertEquals(Optional.of(fb), g_fb.framebufferReadGetBound()); Assert.assertTrue(g_fb.framebufferReadAnyIsBound()); Assert.assertTrue(g_fb.framebufferReadIsBound(fb)); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawIsBound(fb)); g_fb.framebufferReadUnbind(); Assert.assertEquals(Optional.empty(), g_fb.framebufferReadGetBound()); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); Assert.assertFalse(g_fb.framebufferReadIsBound(fb)); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawIsBound(fb)); g_fb.framebufferReadBind(fb); Assert.assertEquals(Optional.of(fb), g_fb.framebufferReadGetBound()); Assert.assertTrue(g_fb.framebufferReadAnyIsBound()); Assert.assertTrue(g_fb.framebufferReadIsBound(fb)); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound());
@Test public final void testFramebufferDeleteIdentitiesRead() { 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.framebufferReadBind(fb); Assert.assertEquals(Optional.of(fb), g_fb.framebufferReadGetBound()); Assert.assertTrue(g_fb.framebufferReadAnyIsBound()); Assert.assertTrue(g_fb.framebufferReadIsBound(fb)); g_fb.framebufferDelete(fb); Assert.assertTrue(fb.isDeleted()); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); }
/** * Copy the contents of the depth/stencil attachment of the G-Buffer to the * current depth/stencil buffer. */ private void renderCopyDepthStencil( final R2GeometryBufferUsableType gbuffer, final AreaInclusiveUnsignedLType lbuffer_area) { final JCGLFramebufferUsableType gb_fb = gbuffer.primaryFramebuffer(); final JCGLFramebuffersType g_fb = this.g.getFramebuffers(); g_fb.framebufferReadBind(gb_fb); g_fb.framebufferBlit( gbuffer.area(), lbuffer_area, DEPTH_STENCIL, JCGLFramebufferBlitFilter.FRAMEBUFFER_BLIT_FILTER_NEAREST); g_fb.framebufferReadUnbind(); }
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); }
@Test public final void testFramebufferBlitSameFramebufferDefault() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final AreaL area = AreasL.create(0L, 0L, 640L, 480L); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); this.expected.expect(JCGLExceptionFramebufferReadDrawSame.class); g_fb.framebufferBlit( area, area, EnumSet.of(JCGLFramebufferBlitBuffer.FRAMEBUFFER_BLIT_BUFFER_DEPTH), JCGLFramebufferBlitFilter.FRAMEBUFFER_BLIT_FILTER_LINEAR); }
final JCGLTextureUnitType u0 = us.get(0); final List<JCGLFramebufferColorAttachmentPointType> points = g_fb.framebufferGetColorAttachments(); final List<JCGLFramebufferDrawBufferType> buffers = g_fb.framebufferGetDrawBuffers(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLTexture2DType td = g_tx.texture2DAllocate( u0, 64L, 64L, fbb.attachDepthTexture2D(td); fbb.attachColorTexture2DAt(points.get(0), buffers.get(0), tc); fb_draw = g_fb.framebufferAllocate(fbb); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLTexture2DType td = g_tx.texture2DAllocate( u0, 64L, 64L, fb_read = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertEquals(Optional.empty(), g_fb.framebufferReadGetBound()); Assert.assertFalse(g_fb.framebufferReadAnyIsBound());
R2FilterFXAA.newFilter(g, sources, id, quad); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); .build(); g_fb.framebufferDrawBind(ib.primaryFramebuffer()); f.runFilter(pro_root, tc, params); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); Assert.assertTrue(g_fb.framebufferDrawIsBound(ib.primaryFramebuffer()));
final JCGLTextureUnitType u0 = us.get(0); final List<JCGLFramebufferColorAttachmentPointType> points = g_fb .framebufferGetColorAttachments(); final List<JCGLFramebufferDrawBufferType> buffers = g_fb .framebufferGetDrawBuffers(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); t_draw_color = g_tx.texture2DAllocate( u0, 64L, 64L, fbb.attachColorTexture2DAt(points.get(0), buffers.get(0), t_draw_color); fbb.attachDepthTexture2D(t_draw_depth); fb_draw = g_fb.framebufferAllocate(fbb); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); t_read_color = g_tx.texture2DAllocate( u0, 64L, 64L, fb_read = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); g_fb.framebufferDrawBind(fb_draw); g_fb.framebufferReadBind(fb_read); g_fb.framebufferBlit( area, area,
final JCGLTexturesType g_tx = i.getTextures(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); Assert.assertEquals(Optional.of(fb), g_fb.framebufferDrawGetBound()); Assert.assertTrue(g_fb.framebufferDrawAnyIsBound()); Assert.assertTrue(g_fb.framebufferDrawIsBound(fb)); g_fb.framebufferDrawUnbind(); Assert.assertEquals(Optional.empty(), g_fb.framebufferDrawGetBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawIsBound(fb)); g_fb.framebufferDrawBind(fb); Assert.assertEquals(Optional.of(fb), g_fb.framebufferDrawGetBound()); Assert.assertTrue(g_fb.framebufferDrawAnyIsBound()); Assert.assertTrue(g_fb.framebufferDrawIsBound(fb));
final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, fb_draw = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); g_fb.framebufferDrawBind(fb_draw); g_fb.framebufferBlit( area, area,
@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 JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); final JCGLTexture2DType t = g_tx.texture2DAllocate( u0, 64L, 64L, fb_read = g_fb.framebufferAllocate(fbb); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); g_fb.framebufferReadBind(fb_read); g_fb.framebufferBlit( area, area,
R2FilterFXAA.newFilter(g, sources, id, quad); g_fb.framebufferDrawUnbind(); g_fb.framebufferReadUnbind(); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); Assert.assertFalse(g_fb.framebufferReadAnyIsBound()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound());
@Test public final void testFramebufferDeleteIdentitiesDraw() { 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); Assert.assertEquals(Optional.of(fb), g_fb.framebufferDrawGetBound()); Assert.assertTrue(g_fb.framebufferDrawAnyIsBound()); Assert.assertTrue(g_fb.framebufferDrawIsBound(fb)); g_fb.framebufferDelete(fb); Assert.assertTrue(fb.isDeleted()); Assert.assertFalse(g_fb.framebufferDrawAnyIsBound()); }
NullCheck.notNull(this.program.getUniforms().get("data")); gf.framebufferDrawBind(this.framebuffer); gs.shaderActivateProgram(this.program); gs.shaderUniformPutVector4f(u_data, x); ga.arrayObjectUnbind(); gs.shaderDeactivateProgram(); gf.framebufferDrawUnbind(); gf.framebufferGetColorAttachments(); final JCGLTexture2DUsableType at = (JCGLTexture2DUsableType)
im.context.contextMakeCurrent(); final List<JCGLFramebufferColorAttachmentPointType> points = g_fb_main.framebufferGetColorAttachments(); im.context.contextReleaseCurrent(); g_fb_alt.framebufferGetDrawBuffers(); ia.context.contextReleaseCurrent(); final JCGLFramebufferBuilderType fbb = g_fb_main.framebufferNewBuilder(); final JCGLTexturesType g_tex = im.getTextures(); final List<JCGLTextureUnitType> us = g_tex.textureGetUnits();
@Test public final void testFramebufferBindDrawDeleted() { 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.framebufferDelete(fb); this.expected.expect(JCGLExceptionDeleted.class); g_fb.framebufferDrawBind(fb); }
@Test public final void testFramebufferIsBoundDrawDeleted() { 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.framebufferDelete(fb); this.expected.expect(JCGLExceptionDeleted.class); g_fb.framebufferDrawIsBound(fb); }
@Override public void renderDepthVariance( final R2DepthVarianceBufferUsableType dbuffer, final JCGLTextureUnitContextParentType uc, final R2MatricesObserverType m, final R2DepthInstancesType s) { NullCheck.notNull(dbuffer); NullCheck.notNull(uc); NullCheck.notNull(m); NullCheck.notNull(s); Preconditions.checkPrecondition( !this.isDeleted(), "Renderer must not be deleted"); final JCGLFramebufferUsableType gb_fb = dbuffer.primaryFramebuffer(); final JCGLFramebuffersType g_fb = this.g.getFramebuffers(); try { g_fb.framebufferDrawBind(gb_fb); this.renderDepthVarianceWithBoundBuffer(dbuffer.area(), uc, m, s); } finally { g_fb.framebufferDrawUnbind(); } }