@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()); } }
@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.unitGetIndex()); } }
@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 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)); } }
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); }
@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 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 testProgramUniformSampler2DCorrect() { final Interfaces i = this.getInterfaces("main"); final JCGLShadersType s = i.getShaders(); final JCGLTexturesType t = i.getTextures(); final JCGLVertexShaderType v = s.shaderCompileVertex("uniforms2", this.getShaderLines("uniforms2.vert")); final JCGLFragmentShaderType f = s.shaderCompileFragment("valid0", this.getShaderLines("valid0.frag")); final JCGLProgramShaderType p = s.shaderLinkProgram("uniforms2", v, Optional.empty(), f); final Map<String, JCGLProgramUniformType> us = p.uniforms(); Assert.assertTrue(us.containsKey("s2")); final JCGLProgramUniformType u = us.get("s2"); Assert.assertEquals(JCGLType.TYPE_SAMPLER_2D, u.type()); s.shaderActivateProgram(p); s.shaderUniformPutTexture2DUnit(u, t.textureGetUnits().get(0)); }
@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 testNewError0() { 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(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_root.unitContextNew(); }
@Test public final void testNewError0() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.textures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.rootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_root.unitContextNew(); }
@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 testBindErrorCube() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.textures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.rootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitType u0 = us.get(0); final JCGLTextureCubeType t0 = newTextureCube(g_tx, u0); g_tx.textureUnitUnbind(u0); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextBindTextureCube(g_tx, t0); }
@Test public final void testNewError1() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.textures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(3, us); final JCGLTextureUnitContextParentType c_root = alloc.rootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextNew(); }
@Test public final void testFinishError0() { 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(); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextFinish(g_tx); }
@Test public final void testNewError1() { 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(3, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextNew(); }
@Test public final void testFinishError0() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.textures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(2, us); final JCGLTextureUnitContextParentType c_root = alloc.rootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); c_0.unitContextFinish(g_tx); this.expected.expect(JCGLExceptionTextureUnitContextNotActive.class); c_0.unitContextFinish(g_tx); }
@Test public final void testUsageBigStackExceeded() { 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(4, us); final JCGLTextureUnitContextParentType c_root = alloc.getRootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); final JCGLTextureUnitContextType c_2 = c_1.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextLimitReached.class); c_2.unitContextNew(); }
@Test public final void testUsageBigStackExceeded() { final JCGLContextType gc = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type g33 = gc.contextGetGL33(); final JCGLTexturesType g_tx = g33.textures(); final List<JCGLTextureUnitType> us = g_tx.textureGetUnits(); final JCGLTextureUnitAllocatorType alloc = this.newAllocator(4, us); final JCGLTextureUnitContextParentType c_root = alloc.rootContext(); final JCGLTextureUnitContextType c_0 = c_root.unitContextNew(); final JCGLTextureUnitContextType c_1 = c_0.unitContextNew(); final JCGLTextureUnitContextType c_2 = c_1.unitContextNew(); this.expected.expect(JCGLExceptionTextureUnitContextLimitReached.class); c_2.unitContextNew(); }
@Test public final void testTexture() { final JCGLContextType c = this.newGL33Context("main", 24, 8); final JCGLInterfaceGL33Type gi = c.contextGetGL33(); final JCGLTexturesType gt = gi.getTextures(); final JCGLTextureUnitAllocatorType tc = JCGLTextureUnitAllocator.newAllocatorWithStack(32, gt.textureGetUnits()); final R2Texture2DType tt = R2SSAONoiseTexture.newNoiseTexture(gt, tc.getRootContext()); final JCGLTexture2DUsableType t = tt.texture(); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals(64L, t.textureGetWidth()); Assert.assertEquals( JCGLTextureFormat.TEXTURE_FORMAT_RGB_8_3BPP, t.textureGetFormat()); } }