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); }
private static JCGLFramebufferType stencillessFramebuffer( 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); }
private static JCGLFramebufferType stencillessFramebuffer( 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 testFramebufferBuildNothing() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); this.expected.expect(JCGLExceptionFramebufferInvalid.class); g_fb.framebufferAllocate(fbb); }
static JCGLFramebufferType newColorFramebuffer( final JCGLInterfaceGL33Type g, final JCGLTextureFormat f, final int w, final int h) { final JCGLTexturesType gt = g.textures(); final JCGLFramebuffersType fb = g.framebuffers(); final JCGLFramebufferBuilderType fbb = fb.framebufferNewBuilder(); final List<JCGLFramebufferColorAttachmentPointType> points = fb.framebufferGetColorAttachments(); final List<JCGLFramebufferDrawBufferType> buffers = fb.framebufferGetDrawBuffers(); final List<JCGLTextureUnitType> units = gt.textureGetUnits(); final JCGLTextureUnitType u = units.get(0); final JCGLTexture2DType t = newTexture2D(g, f, w, h, u); fbb.attachColorTexture2DAt(points.get(0), buffers.get(0), t); return fb.framebufferAllocate(fbb); }
static JCGLFramebufferType newColorFramebuffer( final JCGLInterfaceGL33Type g, final JCGLTextureFormat f, final int w, final int h) { final JCGLTexturesType gt = g.getTextures(); final JCGLFramebuffersType fb = g.getFramebuffers(); final JCGLFramebufferBuilderType fbb = fb.framebufferNewBuilder(); final List<JCGLFramebufferColorAttachmentPointType> points = fb.framebufferGetColorAttachments(); final List<JCGLFramebufferDrawBufferType> buffers = fb.framebufferGetDrawBuffers(); final List<JCGLTextureUnitType> units = gt.textureGetUnits(); final JCGLTextureUnitType u = units.get(0); final JCGLTexture2DType t = JCGLShadersTestUtilities.newTexture2D(g, f, w, h, u); fbb.attachColorTexture2DAt(points.get(0), buffers.get(0), t); return fb.framebufferAllocate(fbb); }
@Test public final void testFramebufferBuildNothing() { final Interfaces i = this.getInterfaces("main"); final JCGLFramebuffersType g_fb = i.getFramebuffers(); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); this.expected.expect(JCGLExceptionFramebufferInvalid.class); g_fb.framebufferAllocate(fbb); }
@Test public final void testFramebufferBuildDepthStencilNotStencil() { 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); this.expected.expect(JCGLExceptionFormatError.class); fbb.attachDepthStencilTexture2D(t); }
@Test public final void testFramebufferBuildDepthStencilNotStencil() { 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); this.expected.expect(JCGLExceptionFormatError.class); fbb.attachDepthStencilTexture2D(t); }
private static R2LightBufferType newDiffuseOnly( final JCGLFramebuffersType g_fb, final R2LightBufferDescriptionType desc, final List<JCGLFramebufferColorAttachmentPointType> points, final List<JCGLFramebufferDrawBufferType> buffers, final Pair<JCGLTextureUnitType, JCGLTexture2DType> p_depth, final Pair<JCGLTextureUnitType, JCGLTexture2DType> p_diff) { final R2Texture2DType rt_depth = R2Texture2DStatic.of(p_depth.getRight()); final R2Texture2DType rt_diff = R2Texture2DStatic.of(p_diff.getRight()); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); fbb.attachColorTexture2DAt( points.get(0), buffers.get(0), rt_diff.texture()); fbb.attachDepthStencilTexture2D(rt_depth.texture()); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); return new R2LightBuffers.LightBufferDiffuseOnly( fb, desc, rt_depth, rt_diff); }
private static R2LightBufferType newSpecularOnly( final JCGLFramebuffersType g_fb, final R2LightBufferDescriptionType desc, final List<JCGLFramebufferColorAttachmentPointType> points, final List<JCGLFramebufferDrawBufferType> buffers, final Pair<JCGLTextureUnitType, JCGLTexture2DType> p_depth, final Pair<JCGLTextureUnitType, JCGLTexture2DType> p_spec) { final R2Texture2DType rt_depth = R2Texture2DStatic.of(p_depth.getRight()); final R2Texture2DType rt_spec = R2Texture2DStatic.of(p_spec.getRight()); final JCGLFramebufferBuilderType fbb = g_fb.framebufferNewBuilder(); fbb.attachColorTexture2DAt( points.get(1), buffers.get(1), rt_spec.texture()); fbb.attachDepthStencilTexture2D(rt_depth.texture()); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); return new R2LightBuffers.LightBufferSpecularOnly( fb, desc, rt_depth, rt_spec); }
@Test public final void testFramebufferBuildDepthNotStencil() { 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_24_STENCIL_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); this.expected.expect(JCGLExceptionFormatError.class); fbb.attachDepthTexture2D(t); }
@Test public final void testFramebufferBuildDepthNotStencil() { 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_24_STENCIL_8_4BPP, JCGLTextureWrapS.TEXTURE_WRAP_REPEAT, JCGLTextureWrapT.TEXTURE_WRAP_REPEAT, JCGLTextureFilterMinification.TEXTURE_FILTER_NEAREST, JCGLTextureFilterMagnification.TEXTURE_FILTER_NEAREST); this.expected.expect(JCGLExceptionFormatError.class); fbb.attachDepthTexture2D(t); }
@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); }
@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); }
@Test public final void testFramebufferBindReadDeleted() { 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.framebufferReadBind(fb); }
@Test public final void testFramebufferBuildDepthOnly() { 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); fbb.attachDepthTexture2D(t); final JCGLFramebufferType fb = g_fb.framebufferAllocate(fbb); Assert.assertEquals(0L, (long) fb.framebufferStencilBits()); Assert.assertEquals(16L, (long) fb.framebufferDepthBits()); }
@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); }
@Test public final void testFramebufferBuildWrongContextAllocate() { final Interfaces im = this.getInterfaces("main"); final Interfaces ia = this.getInterfaces("alt"); final JCGLFramebuffersType g_fb_main = im.getFramebuffers(); final JCGLFramebuffersType g_fb_alt = ia.getFramebuffers(); Assert.assertFalse(im.context.contextIsCurrent()); Assert.assertTrue(ia.context.contextIsCurrent()); final JCGLFramebufferBuilderType fbb = g_fb_alt.framebufferNewBuilder(); ia.context.contextReleaseCurrent(); im.context.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); g_fb_main.framebufferAllocate(fbb); }
@Test public final void testFramebufferBuildWrongContextAllocate() { final Interfaces im = this.getInterfaces("main"); final Interfaces ia = this.getInterfaces("alt"); final JCGLFramebuffersType g_fb_main = im.getFramebuffers(); final JCGLFramebuffersType g_fb_alt = ia.getFramebuffers(); Assert.assertFalse(im.context.contextIsCurrent()); Assert.assertTrue(ia.context.contextIsCurrent()); final JCGLFramebufferBuilderType fbb = g_fb_alt.framebufferNewBuilder(); ia.context.contextReleaseCurrent(); im.context.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); g_fb_main.framebufferAllocate(fbb); }