private static void configureDepth( final JCGLInterfaceGL33Type g, final JCGLRenderStateType r) { final JCGLDepthBuffersType g_d = g.depthBuffers(); final JCGLDepthStateType ds = r.depthState(); configureDepthWriting(g_d, ds); configureDepthClamping(g_d, ds); configureDepthTesting(g_d, ds); }
@Test public final void testDepthTestWriteNonStrict() { final JCGLInterfaceGL33Type g = this.getGL33("main", 24, 8); final JCGLRenderStateMutable r = JCGLRenderStateMutable.create(); final JCGLDepthStateMutable ds = JCGLDepthStateMutable.create(); ds.setDepthStrict(JCGLDepthStrict.DEPTH_STRICT_DISABLED); ds.setDepthClamp(JCGLDepthClamping.DEPTH_CLAMP_ENABLED); ds.setDepthTest(Optional.of(JCGLDepthFunction.DEPTH_EQUAL)); ds.setDepthWrite(JCGLDepthWriting.DEPTH_WRITE_ENABLED); r.setDepthState(ds); JCGLRenderStates.activate(g, r); final JCGLDepthBuffersType g_d = g.depthBuffers(); Assert.assertTrue(g_d.depthBufferTestIsEnabled()); Assert.assertTrue(g_d.depthBufferWriteIsEnabled()); Assert.assertTrue(g_d.depthClampingIsEnabled()); }
@Test public final void testDepthTestWriteStrict() { final JCGLInterfaceGL33Type g = this.getGL33("main", 24, 8); final JCGLRenderStateMutable r = JCGLRenderStateMutable.create(); final JCGLDepthStateMutable ds = JCGLDepthStateMutable.create(); ds.setDepthStrict(JCGLDepthStrict.DEPTH_STRICT_ENABLED); ds.setDepthClamp(JCGLDepthClamping.DEPTH_CLAMP_ENABLED); ds.setDepthTest(Optional.of(JCGLDepthFunction.DEPTH_EQUAL)); ds.setDepthWrite(JCGLDepthWriting.DEPTH_WRITE_ENABLED); r.setDepthState(ds); JCGLRenderStates.activate(g, r); final JCGLDepthBuffersType g_d = g.depthBuffers(); Assert.assertTrue(g_d.depthBufferTestIsEnabled()); Assert.assertTrue(g_d.depthBufferWriteIsEnabled()); Assert.assertTrue(g_d.depthClampingIsEnabled()); }
@Test public final void testInitialState() { final JCGLInterfaceGL33Type g = this.getGL33("main", 24, 8); final JCGLRenderStateMutable r = JCGLRenderStateMutable.create(); JCGLRenderStates.activate(g, r); final JCGLBlendingType g_b = g.blending(); final JCGLCullingType g_c = g.culling(); final JCGLDepthBuffersType g_d = g.depthBuffers(); final JCGLColorBufferMaskingType g_cm = g.colorBufferMasking(); final JCGLPolygonModesType g_p = g.polygonModes(); final JCGLScissorType g_s = g.scissor(); Assert.assertFalse(g_b.blendingIsEnabled()); Assert.assertFalse(g_c.cullingIsEnabled()); Assert.assertTrue(g_cm.colorBufferMaskStatusRed()); Assert.assertTrue(g_cm.colorBufferMaskStatusGreen()); Assert.assertTrue(g_cm.colorBufferMaskStatusBlue()); Assert.assertTrue(g_cm.colorBufferMaskStatusAlpha()); Assert.assertFalse(g_d.depthBufferTestIsEnabled()); Assert.assertFalse(g_d.depthBufferWriteIsEnabled()); Assert.assertFalse(g_d.depthClampingIsEnabled()); Assert.assertEquals(JCGLPolygonMode.POLYGON_FILL, g_p.polygonGetMode()); Assert.assertFalse(g_s.scissorIsEnabled()); }