List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.ardor3d.scene.state.lwjgl.LwjglFragmentProgramStateUtil.java
License:Open Source License
public static void apply(final FragmentProgramState state) { final RenderContext context = ContextManager.getCurrentContext(); if (context.getCapabilities().isFragmentProgramSupported()) { final FragmentProgramStateRecord record = (FragmentProgramStateRecord) context .getStateRecord(StateType.FragmentProgram); context.setCurrentState(StateType.FragmentProgram, state); if (!record.isValid() || record.getReference() != state) { record.setReference(state);/*from w w w.j av a 2 s. c om*/ if (state.isEnabled()) { // Fragment program not yet loaded if (state._getProgramID() == -1) { if (state.getProgramAsBuffer() != null) { final int id = create(state.getProgramAsBuffer()); state._setProgramID(id); } else { return; } } GL11.glEnable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); ARBProgram.glBindProgramARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, state._getProgramID()); // load environmental parameters... // TODO: Reevaluate how this is done. /* * for (int i = 0; i < envparameters.length; i++) if (envparameters[i] != null) * ARBFragmentProgram.glProgramEnvParameter4fARB( ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, i, * envparameters[i][0], envparameters[i][1], envparameters[i][2], envparameters[i][3]); */ // load local parameters... if (state.isUsingParameters()) { // no parameters are used for (int i = 0; i < state._getParameters().length; i++) { if (state._getParameters()[i] != null) { ARBProgram.glProgramLocalParameter4fARB(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB, i, state._getParameters()[i][0], state._getParameters()[i][1], state._getParameters()[i][2], state._getParameters()[i][3]); } } } } else { GL11.glDisable(ARBFragmentProgram.GL_FRAGMENT_PROGRAM_ARB); } } if (!record.isValid()) { record.validate(); } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setSingleLightEnabled(final boolean enable, final int index, final LightStateRecord record, final LightRecord lr) { if (!record.isValid() || lr.isEnabled() != enable) { if (enable) { GL11.glEnable(GL11.GL_LIGHT0 + index); } else {//from ww w .j a v a 2 s. c o m GL11.glDisable(GL11.GL_LIGHT0 + index); } lr.setEnabled(enable); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setLightEnabled(final boolean enable, final LightStateRecord record) { if (!record.isValid() || record.isEnabled() != enable) { if (enable) { GL11.glEnable(GL11.GL_LIGHTING); } else {/*from ww w .j a v a 2 s . com*/ GL11.glDisable(GL11.GL_LIGHTING); } record.setEnabled(enable); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglMaterialStateUtil.java
License:Open Source License
private static void applyColorMaterial(final ColorMaterial colorMaterial, final MaterialFace face, final MaterialStateRecord record) { if (!record.isValid() || face != record.colorMaterialFace || colorMaterial != record.colorMaterial) { if (colorMaterial == ColorMaterial.None) { GL11.glDisable(GL11.GL_COLOR_MATERIAL); } else {//from w ww . j a v a2 s .c om final int glMat = getGLColorMaterial(colorMaterial); final int glFace = getGLMaterialFace(face); GL11.glColorMaterial(glFace, glMat); GL11.glEnable(GL11.GL_COLOR_MATERIAL); record.resetColorsForCM(face, colorMaterial); } record.colorMaterial = colorMaterial; record.colorMaterialFace = face; } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglOffsetStateUtil.java
License:Open Source License
private static void setOffsetEnabled(final OffsetType type, final boolean typeEnabled, final OffsetStateRecord record) { final int glType = getGLType(type); if (!record.isValid() || typeEnabled != record.enabledOffsets.contains(type)) { if (typeEnabled) { GL11.glEnable(glType);/*from w w w. ja va 2 s . c om*/ } else { GL11.glDisable(glType); } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglStencilStateUtil.java
License:Open Source License
private static void setEnabled(final boolean enable, final boolean twoSided, final StencilStateRecord record, final ContextCapabilities caps) { if (record.isValid()) { if (enable && !record.enabled) { GL11.glEnable(GL11.GL_STENCIL_TEST); } else if (!enable && record.enabled) { GL11.glDisable(GL11.GL_STENCIL_TEST); }// w w w . j a va 2s .c o m } else { if (enable) { GL11.glEnable(GL11.GL_STENCIL_TEST); } else { GL11.glDisable(GL11.GL_STENCIL_TEST); } } setTwoSidedEnabled(enable ? twoSided : false, record, caps); record.enabled = enable; }
From source file:com.ardor3d.scene.state.lwjgl.LwjglStencilStateUtil.java
License:Open Source License
private static void setTwoSidedEnabled(final boolean enable, final StencilStateRecord record, final ContextCapabilities caps) { if (caps.isTwoSidedStencilSupported()) { if (record.isValid()) { if (enable && !record.useTwoSided) { GL11.glEnable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); } else if (!enable && record.useTwoSided) { GL11.glDisable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); }/* w w w. java 2s. c o m*/ } else { if (enable) { GL11.glEnable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); } else { GL11.glDisable(EXTStencilTwoSide.GL_STENCIL_TEST_TWO_SIDE_EXT); } } } record.useTwoSided = enable; }
From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java
License:Open Source License
private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record, final int unit, final Type exceptedType, final ContextCapabilities caps) { if (exceptedType != Type.TwoDimensional) { if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL11.GL_TEXTURE_2D); unitRecord.enabled[Type.TwoDimensional.ordinal()] = false; }/*from www. java2 s . co m*/ } if (exceptedType != Type.OneDimensional) { if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL11.GL_TEXTURE_1D); unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } } if (caps.isTexture3DSupported() && exceptedType != Type.ThreeDimensional) { if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL12.GL_TEXTURE_3D); unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; } } if (caps.isTextureCubeMapSupported() && exceptedType != Type.CubeMap) { if (!unitRecord.isValid() || unitRecord.enabled[Type.CubeMap.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB); unitRecord.enabled[Type.CubeMap.ordinal()] = false; } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java
License:Open Source License
private static void disableTexturing(final TextureUnitRecord unitRecord, final TextureStateRecord record, final int unit, final ContextCapabilities caps) { if (!unitRecord.isValid() || unitRecord.enabled[Type.TwoDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL11.GL_TEXTURE_2D); unitRecord.enabled[Type.TwoDimensional.ordinal()] = false; }/*from ww w .j av a 2s.co m*/ if (!unitRecord.isValid() || unitRecord.enabled[Type.OneDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL11.GL_TEXTURE_1D); unitRecord.enabled[Type.OneDimensional.ordinal()] = false; } if (caps.isTexture3DSupported()) { if (!unitRecord.isValid() || unitRecord.enabled[Type.ThreeDimensional.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(GL12.GL_TEXTURE_3D); unitRecord.enabled[Type.ThreeDimensional.ordinal()] = false; } } if (caps.isTextureCubeMapSupported()) { if (!unitRecord.isValid() || unitRecord.enabled[Type.CubeMap.ordinal()]) { // Check we are in the right unit checkAndSetUnit(unit, record, caps); GL11.glDisable(ARBTextureCubeMap.GL_TEXTURE_CUBE_MAP_ARB); unitRecord.enabled[Type.CubeMap.ordinal()] = false; } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglTextureStateUtil.java
License:Open Source License
private static void setTextureGen(final TextureUnitRecord unitRecord, final int unit, final TextureStateRecord record, final ContextCapabilities caps, final boolean genS, final boolean genT, final boolean genR, final boolean genQ) { if (!unitRecord.isValid()) { checkAndSetUnit(unit, record, caps); if (genS) { GL11.glEnable(GL11.GL_TEXTURE_GEN_S); } else {// w ww . j av a 2 s .c o m GL11.glDisable(GL11.GL_TEXTURE_GEN_S); } if (genT) { GL11.glEnable(GL11.GL_TEXTURE_GEN_T); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_T); } if (genR) { GL11.glEnable(GL11.GL_TEXTURE_GEN_R); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_R); } if (genQ) { GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); } } else { if (genS != unitRecord.textureGenS) { checkAndSetUnit(unit, record, caps); if (genS) { GL11.glEnable(GL11.GL_TEXTURE_GEN_S); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_S); } } if (genT != unitRecord.textureGenT) { checkAndSetUnit(unit, record, caps); if (genT) { GL11.glEnable(GL11.GL_TEXTURE_GEN_T); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_T); } } if (genR != unitRecord.textureGenR) { checkAndSetUnit(unit, record, caps); if (genR) { GL11.glEnable(GL11.GL_TEXTURE_GEN_R); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_R); } } if (genQ != unitRecord.textureGenQ) { checkAndSetUnit(unit, record, caps); if (genQ) { GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); } else { GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); } } } unitRecord.textureGenS = genS; unitRecord.textureGenT = genT; unitRecord.textureGenR = genR; unitRecord.textureGenQ = genQ; }