private static void configureCulling( final JCGLInterfaceGL33Type g, final JCGLRenderStateType r) { final JCGLCullingType g_c = g.culling(); final Optional<JCGLCullingStateType> cull_opt = r.cullingState(); if (cull_opt.isPresent()) { final JCGLCullingStateType cull_state = cull_opt.get(); g_c.cullingEnable( cull_state.faceSelection(), cull_state.faceWindingOrder()); } else { g_c.cullingDisable(); } }
@Test public final void testCulling() { final JCGLInterfaceGL33Type g = this.getGL33("main", 24, 8); final JCGLRenderStateMutable r = JCGLRenderStateMutable.create(); final JCGLCullingStateMutable cs = JCGLCullingStateMutable.create(); cs.setFaceSelection(JCGLFaceSelection.FACE_FRONT); cs.setFaceWindingOrder(JCGLFaceWindingOrder.FRONT_FACE_CLOCKWISE); r.setCullingState(Optional.of(cs)); JCGLRenderStates.activate(g, r); final JCGLCullingType g_c = g.culling(); Assert.assertTrue(g_c.cullingIsEnabled()); }
@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()); }