Example usage for org.lwjgl.opengl GL11 glDisable

List of usage examples for org.lwjgl.opengl GL11 glDisable

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glDisable.

Prototype

public static void glDisable(@NativeType("GLenum") int target) 

Source Link

Document

Disables the specified OpenGL state.

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglVertexProgramStateUtil.java

License:Open Source License

/**
 * Applies this vertex program to the current scene. Checks if the GL_ARB_vertex_program extension is supported
 * before attempting to enable this program.
 * // w  w w. j a  v  a2s  .co m
 * @see com.ardor3d.renderer.state.RenderState#apply()
 */
public static void apply(final VertexProgramState state) {
    final RenderContext context = ContextManager.getCurrentContext();
    if (context.getCapabilities().isVertexProgramSupported()) {
        // ask for the current state record
        final VertexProgramStateRecord record = (VertexProgramStateRecord) context
                .getStateRecord(StateType.VertexProgram);
        context.setCurrentState(StateType.VertexProgram, state);

        if (!record.isValid() || record.getReference() != state) {
            record.setReference(state);
            if (state.isEnabled()) {
                // Vertex 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(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
                ARBProgram.glBindProgramARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, state._getProgramID());

                // load environmental parameters...
                for (int i = 0; i < VertexProgramState._getEnvParameters().length; i++) {
                    if (VertexProgramState._getEnvParameters()[i] != null) {
                        ARBProgram.glProgramEnvParameter4fARB(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, i,
                                VertexProgramState._getEnvParameters()[i][0],
                                VertexProgramState._getEnvParameters()[i][1],
                                VertexProgramState._getEnvParameters()[i][2],
                                VertexProgramState._getEnvParameters()[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(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB, i,
                                    state._getParameters()[i][0], state._getParameters()[i][1],
                                    state._getParameters()[i][2], state._getParameters()[i][3]);
                        }
                    }
                }

            } else {
                GL11.glDisable(ARBVertexProgram.GL_VERTEX_PROGRAM_ARB);
            }
        }

        if (!record.isValid()) {
            record.validate();
        }
    }
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglZBufferStateUtil.java

License:Open Source License

private static void enableDepthTest(final boolean enable, final ZBufferStateRecord record) {
    if (enable && (!record.depthTest || !record.isValid())) {
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        record.depthTest = true;/*from   w  ww . j a va2 s . c  om*/
    } else if (!enable && (record.depthTest || !record.isValid())) {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        record.depthTest = false;
    }
}

From source file:com.ardor3d.scene.state.lwjgl.util.LwjglRendererUtil.java

License:Open Source License

public static void setClippingEnabled(final RendererRecord rendRecord, final boolean enabled) {
    if (enabled && (!rendRecord.isClippingTestValid() || !rendRecord.isClippingTestEnabled())) {
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        rendRecord.setClippingTestEnabled(true);
    } else if (!enabled && (!rendRecord.isClippingTestValid() || rendRecord.isClippingTestEnabled())) {
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
        rendRecord.setClippingTestEnabled(false);
    }/*from w  ww .ja  v a  2s  .c  o  m*/
    rendRecord.setClippingTestValid(true);
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

public void glDisable(int cap) {
    GL11.glDisable(cap);
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glDisable(int cap) {
    GL11.glDisable(cap);
}

From source file:com.blogspot.jabelarminecraft.magicbeans.renderers.RenderGoldenEggThrown.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *//*from   w  w  w  .j a v  a2s  .c  o m*/
@Override
public void doRender(Entity parEntity, double parX, double parY, double parZ, float parIgnored1,
        float parIgnored2) {
    //        IIcon iicon = itemBasisForEntity.getIconFromDamage(iconIndex);
    //        
    //        if (iicon != null)
    //        {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) parX, (float) parY, (float) parZ);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    int l = 0xF5E16F;
    float f5 = (l >> 16 & 255) / 255.0F;
    float f6 = (l >> 8 & 255) / 255.0F;
    float f7 = (l & 255) / 255.0F;
    GL11.glColor4f(f5, f6, f7, 1.0F);
    bindEntityTexture(parEntity);
    Tessellator tessellator = Tessellator.getInstance();

    //            if (iicon == ItemPotion.func_94589_d("bottle_splash"))
    //            {
    //                int i = PotionHelper.func_77915_a(((EntityPotion)parEntity).getPotionDamage(), false);
    //                float f2 = (i >> 16 & 255) / 255.0F;
    //                float f3 = (i >> 8 & 255) / 255.0F;
    //                float f4 = (i & 255) / 255.0F;
    //                GL11.glColor3f(f2, f3, f4);
    //                GL11.glPushMatrix();
    //                invokeTesselator(tessellator, ItemPotion.func_94589_d("overlay"));
    //                GL11.glPopMatrix();
    //                GL11.glColor3f(1.0F, 1.0F, 1.0F);
    //            }

    //            invokeTesselator(tessellator, iicon);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    //        }
}

From source file:com.blogspot.jabelarminecraft.wildanimals.renderers.RenderThrowableSpawnEgg.java

License:Open Source License

/**
 * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
 * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
 * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
 * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
 *//*from  ww  w. ja v a 2s  .c  o  m*/
public void doRender(EntityWildAnimalsEgg parEntityWildAnimalsEgg, double parPosX, double parPosY,
        double parPosZ, float p_76986_8_, float parTweenFactor) {
    bindEntityTexture(parEntityWildAnimalsEgg);
    GL11.glPushMatrix();
    GL11.glTranslatef((float) parPosX, (float) parPosY, (float) parPosZ);
    GL11.glRotatef(parEntityWildAnimalsEgg.prevRotationYaw
            + (parEntityWildAnimalsEgg.rotationYaw - parEntityWildAnimalsEgg.prevRotationYaw) * parTweenFactor
            - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(parEntityWildAnimalsEgg.prevRotationPitch
            + (parEntityWildAnimalsEgg.rotationPitch - parEntityWildAnimalsEgg.prevRotationPitch)
                    * parTweenFactor,
            0.0F, 0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;
    byte b0 = 0;
    float f2 = 0.0F;
    float f3 = 0.5F;
    float f4 = 0.0F;
    float f5 = 5 / 32.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = 5 / 32.0F;
    float f9 = 10 / 32.0F;
    float scaleFactor = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float f11 = -parTweenFactor;

    if (f11 > 0.0F) {
        float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
        GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
    }

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(scaleFactor, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);
    tessellator.draw();
    GL11.glNormal3f(-scaleFactor, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, scaleFactor);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5);
        tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.client.render.RenderEngine.java

License:Open Source License

@SuppressWarnings("cast")
@Override//  w w w . j ava 2s  .  c o m
public void renderTileEntityAt(TileEntity engine, double x, double y, double z, float f) {

    if (engine instanceof TileEngine) {

        GL11.glPushMatrix();
        GL11.glDisable(GL11.GL_LIGHTING);
        TileEngine tile = (TileEngine) engine.getWorldObj().getTileEntity(engine.xCoord, engine.yCoord,
                engine.zCoord);

        ForgeDirection direction = tile.getOrientation();

        GL11.glTranslated(x, y, z);
        GL11.glScaled(.0315, .0315, .0315);

        if (direction == ForgeDirection.UP) {
            GL11.glTranslated(16, 28, 16);
            GL11.glRotatef(180, 1, 0, 0);
        }
        if (direction == ForgeDirection.DOWN) {
            GL11.glTranslated(16, 4, 16);
            GL11.glRotatef(0, 0, 0, 0);
        }
        if (direction == ForgeDirection.EAST) {
            GL11.glTranslated(28, 16, 16);
            GL11.glRotatef(90, 0, 0, 1);
        }
        if (direction == ForgeDirection.WEST) {
            GL11.glTranslated(4, 16, 16);
            GL11.glRotatef(90, 0, 0, -1);
        }
        if (direction == ForgeDirection.NORTH) {
            GL11.glTranslated(16, 16, 4);
            GL11.glRotatef(90, 1, 0, 0);
        }
        if (direction == ForgeDirection.SOUTH) {
            GL11.glTranslated(16, 16, 28);
            GL11.glRotatef(90, -1, 0, 0);
        }
        if (tile.isActive) {
            bindTexture(textureLocationOn);
        } else {
            bindTexture(textureLocationOff);
        }
        engineModel.renderAllExcept("gear", "glider");

        if (tile.isActive) {
            f += tile.pumpTick;
            if (tile.pumpSpeed > 0) {
                f /= tile.pumpSpeed;
            }
        } else {
            f = 0;
        }
        f = (float) ((float) 6 * (.5 - .5 * Math.cos(3.1415926535897931D * (double) f)));
        GL11.glTranslatef(0, f, 0);

        engineModel.renderPart("glider");

        GL11.glTranslatef(0, -f, 0);

        if (tile.isActive) {
            if (tile.getWorldObj().isRemote) {
                rotateAmount++;

                GL11.glRotated(tile.gearTick * 19, 0, 1.5707963267948966D * (double) f, 0);
            }
        }
        engineModel.renderPart("gear");

        GL11.glEnable(GL11.GL_LIGHTING);

        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.client.render.RenderHelper.java

License:Open Source License

public static void renderRedstoneTorch(double x, double y, double z, double height, boolean state,
        boolean digital) {

    GL11.glPushMatrix();// w w w. jav a2  s  .  c om
    {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

        if (digital) {
            rb.overrideBlockTexture = state ? IconSupplier.bluestoneTorchOn : IconSupplier.bluestoneTorchOff;
        } else {
            rb.overrideBlockTexture = state ? Blocks.redstone_torch.getIcon(0, 0)
                    : Blocks.unlit_redstone_torch.getIcon(0, 0);
        }

        GL11.glEnable(GL11.GL_CLIP_PLANE0);
        GL11.glClipPlane(GL11.GL_CLIP_PLANE0,
                uk.co.qmunity.lib.client.render.RenderUtils.planeEquation(0, 1, 0));

        GL11.glTranslated(x, y + height - 1, z);

        Tessellator t = Tessellator.instance;

        t.setColorOpaque_F(1.0F, 1.0F, 1.0F);
        t.startDrawingQuads();
        {
            rb.setRenderBounds(7 / 16D, 0, 0, 9 / 16D, 1, 1);
            t.setNormal(-1, 1, 0);
            rb.renderFaceXNeg(Blocks.stone, 0, 0, 0, null);
            t.setNormal(1, 1, 0);
            rb.renderFaceXPos(Blocks.stone, 0, 0, 0, null);

            rb.setRenderBounds(0, 0, 7 / 16D, 1, 1, 9 / 16D);
            t.setNormal(0, 1, -1);
            rb.renderFaceZNeg(Blocks.stone, 0, 0, 0, null);
            t.setNormal(0, 1, 1);
            rb.renderFaceZPos(Blocks.stone, 0, 0, 0, null);

            rb.setRenderBounds(7 / 16D, 0, 6 / 16D, 9 / 16D, 10 / 16D, 8 / 16D);
            t.setNormal(0, 1, 0);
            rb.renderFaceYPos(Blocks.stone, 0, 0, 1 / 16D, null);
        }
        t.draw();

        GL11.glDisable(GL11.GL_CLIP_PLANE0);

        rb.overrideBlockTexture = null;
    }
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.client.render.RenderItemEngine.java

License:Open Source License

private void renderEngine(float x, float y, float z, float rotateAmount, float rotatex, float rotatey,
        float rotatez) {

    GL11.glPushMatrix();//  ww  w.j  a  v a2  s .  c o m
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glScalef(.034F, .034F, .034F);
    GL11.glTranslated(x, y, z);
    GL11.glRotatef(rotateAmount, rotatex, rotatey, rotatez);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(textureLocation);

    model.renderAll();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}