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.bluepowermod.client.render.RenderLamp.java

License:Open Source License

/******* TESR ***********/
@Override//from  w ww  .  j av a2s  .c om
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {

    if (pass != 0) {
        BlockLamp bLamp = (BlockLamp) te.getBlockType();
        int power = ((TileLamp) te).getPower();

        int color = bLamp.getColor(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);

        int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF;
        int r = (color & redMask) >> 16;
        int g = (color & greenMask) >> 8;
        int b = (color & blueMask);

        if (bLamp.isInverted()) {
            power = 15 - power;
        }
        // power = 15;
        Vec3i vector = new Vec3i(te);
        Vec3dCube box = new Vec3dCube(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5).expand(0.8 / 16D);

        boolean[] renderFaces = new boolean[] { true, true, true, true, true, true };

        for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
            Vec3i v = vector.getRelative(d);
            Block bl = v.getBlock();
            if (bl instanceof BlockLamp
                    && ((BlockLamp) bl).getPower(v.getWorld(), v.getX(), v.getY(), v.getZ()) > 0) {
                if (d.offsetX < 0) {
                    box.getMin().setX(-0.5);
                    renderFaces[2] = false;
                } else if (d.offsetY < 0) {
                    box.getMin().setY(-0.5);
                    renderFaces[1] = false;
                } else if (d.offsetZ < 0) {
                    box.getMin().setZ(-0.5);
                    renderFaces[4] = false;
                } else if (d.offsetX > 0) {
                    box.getMax().setX(0.5);
                    renderFaces[3] = false;
                } else if (d.offsetY > 0) {
                    box.getMax().setY(0.5);
                    renderFaces[0] = false;
                } else if (d.offsetZ > 0) {
                    box.getMax().setZ(0.5);
                    renderFaces[5] = false;
                }
            }
        }

        box.getMin().add(0.5, 0.5, 0.5);
        box.getMax().add(0.5, 0.5, 0.5);

        GL11.glTranslated(x, y, z);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        // GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glBegin(GL11.GL_QUADS);
        double powerDivision = power / 18D;
        com.bluepowermod.client.render.RenderHelper.drawColoredCube(box, r / 256D, g / 256D, b / 256D,
                powerDivision * 0.625D, renderFaces);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
        GL11.glDisable(GL11.GL_BLEND);

        GL11.glTranslated(-x, -y, -z);
    }
}

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

License:Open Source License

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    GL11.glPushMatrix();//from  ww w  . j  a  va 2 s  .co  m
    {
        switch (type) {
        case ENTITY:
            GL11.glTranslated(-0.5, -0.5, -0.5);
            break;
        case EQUIPPED:
            break;
        case EQUIPPED_FIRST_PERSON:
            GL11.glTranslated(0, -0.1, 0);
            break;
        case INVENTORY:
            GL11.glTranslated(0, -0.1, 0);
            break;
        default:
            break;
        }

        BlockLamp block = (BlockLamp) Block.getBlockFromItem(item.getItem());
        int redMask = 0xFF0000, greenMask = 0xFF00, blueMask = 0xFF;
        int r = (block.getColor() & redMask) >> 16;
        int g = (block.getColor() & greenMask) >> 8;
        int b = (block.getColor() & blueMask);

        Vec3dCube cube = new Vec3dCube(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);

        Tessellator t = Tessellator.instance;
        t.startDrawingQuads();
        t.setColorOpaque(r, g, b);

        RenderHelper h = RenderHelper.instance;
        h.reset();
        h.setColor(block.getColor());
        h.renderBox(cube, block.isInverted() ? BlockLamp.on : BlockLamp.off);
        h.reset();

        t.draw();
        if (block.isInverted()) {
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
            // GL11.glAlphaFunc(GL11.GL_EQUAL, (power / 15F) * 1F);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_LIGHTING);
            // GL11.glDisable(GL11.GL_CULL_FACE);
            GL11.glDepthMask(false);
            GL11.glBegin(GL11.GL_QUADS);
            com.bluepowermod.client.render.RenderHelper.drawColoredCube(cube.clone().expand(0.8 / 16D),
                    r / 256D, g / 256D, b / 256D, 0.625D);
            GL11.glEnd();
            GL11.glDepthMask(true);
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            // GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    GL11.glPopMatrix();
}

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

License:Open Source License

private void render(float x, float y, float z, float scale, ItemRenderType type, ItemStack item,
        Object... data) {//ww w  .  j a v a2s  .  c  om

    boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
    boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);

    GL11.glPushMatrix();
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(x, y, z);
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
    try {
        BPPart part = PartManager.getExample(item);
        part.renderItem(type, item, data);
    } catch (Exception ex) {
    }
    GL11.glPopMatrix();

    if (!blend)
        GL11.glDisable(GL11.GL_BLEND);
    if (!alpha)
        GL11.glDisable(GL11.GL_ALPHA_TEST);
}

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

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float var8) {
    TileWindmill mill = (TileWindmill) tile.getWorldObj().getTileEntity(tile.xCoord, tile.yCoord, tile.zCoord);

    GL11.glPushMatrix();/*ww  w  .j ava2 s . c  o  m*/
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glTranslated(x + .5, y, z + .5);
    GL11.glScaled(.15, .15, .15);
    this.bindTexture(textureLocation);

    GL11.glRotated(mill.turbineTick, 0, 1, 0);
    model.renderAll();
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:com.bluepowermod.compat.fmp.SawRenderFMP.java

License:Open Source License

@Override
public void renderItem(ItemRenderType renderType, ItemStack item, Object... data) {

    double pi = Math.PI;

    Transformation t;/*w w w.j  a va 2 s  .c  o m*/
    switch (renderType) {
    case INVENTORY:
        t = new TransformationList(new Scale(1.8), new Translation(0, 0, -0.6), new Rotation(-pi / 4, 1, 0, 0),
                new Rotation(pi * 3 / 4, 0, 1, 0));
        break;
    case ENTITY:
        t = new TransformationList(new Scale(1), new Translation(0, 0, -0.25), new Rotation(-pi / 4, 1, 0, 0));
        break;
    case EQUIPPED_FIRST_PERSON:
        t = new TransformationList(new Scale(1.5), new Rotation(-pi / 3, 1, 0, 0),
                new Rotation(pi * 3 / 4, 0, 1, 0), new Translation(0.5, 0.5, 0.5));
        break;
    case EQUIPPED:
        t = new TransformationList(new Scale(1.5), new Rotation(-pi / 5, 1, 0, 0),
                new Rotation(-pi * 3 / 4, 0, 1, 0), new Translation(0.75, 0.5, 0.75));
        break;
    default:
        t = null;
        break;
    }

    CCRenderState.reset();
    CCRenderState.useNormals = true;
    CCRenderState.pullLightmap();
    CCRenderState.changeTexture("microblock:textures/items/saw.png");
    CCRenderState.startDrawing();
    handle.render(t);
    holder.render(t);
    CCRenderState.draw();
    GL11.glDisable(GL11.GL_CULL_FACE);
    CCRenderState.changeTexture(Refs.MODID + ":textures/items/fmpsaw.png");
    CCRenderState.startDrawing();
    int tex = 0;
    if (item.getItem() == BPItems.ruby_saw) {
        tex = 0;
    } else if (item.getItem() == BPItems.amethyst_saw) {
        tex = 1;
    } else if (item.getItem() == BPItems.sapphire_saw) {
        tex = 2;
    }
    blade.render(t, new UVTranslation(0, tex * 4 / 64D));
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:com.bluepowermod.part.gate.GateRSLatch.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//w  w w.ja v a  2  s.c  om
public void renderTop(float frame) {

    if (mode % 2 == 1) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glScaled(-1, 1, 1);
        GL11.glTranslated(-0.5, 0, -0.5);

        GL11.glDisable(GL11.GL_CULL_FACE);
    }

    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(
            Refs.MODID + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/base.png"));
    this.renderTop();

    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID
            + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/left_"
            + ((mode % 2 == 0 ? left().getInput() > 0 : right().getInput() > 0) ? "on" : "off") + ".png"));
    renderTop();
    Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Refs.MODID
            + ":textures/blocks/gates/" + getTextureName() + (mode > 1 ? "2" : "") + "/right_"
            + ((mode % 2 == 0 ? right().getInput() > 0 : left().getInput() > 0) ? "on" : "off") + ".png"));
    renderTop();
    if (mode > 1) {
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName()
                        + "2/front" + "_" + (front().getInput() > 0 ? "on" : "off") + ".png"));
        renderTop();
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID + ":textures/blocks/gates/" + getTextureName()
                        + "2/back" + "_" + (back().getInput() > 0 ? "on" : "off") + ".png"));
        renderTop();
    }

    RenderHelper.renderDigitalRedstoneTorch(1D / 8D, 3D / 16D, -2D / 8D, 9D / 16D, front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(-1D / 8D, 3D / 16D, 2D / 8D, 9D / 16D, back().getInput() == 0);

    if (mode % 2 == 1) {
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.part.gate.GateTransparentLatch.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/*  www .j av a 2s.co  m*/
public void renderTop(float frame) {

    if (mirrored) {
        GL11.glPushMatrix();
        GL11.glTranslated(0.5, 0, 0.5);
        GL11.glScaled(-1, 1, 1);
        GL11.glTranslated(-0.5, 0, -0.5);

        GL11.glDisable(GL11.GL_CULL_FACE);
    }

    renderTop("front", front());
    renderTop("left", mirrored ? right() : left());
    renderTop("back", back());
    renderTop("leftcenter", back().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(4 / 16D, 3D / 16D, -4 / 16D, 8D / 16D, back().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(4 / 16D, 3D / 16D, 1 / 16D, 8D / 16D,
            back().getInput() > 0 && front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(1 / 16D, 3D / 16D, 1 / 16D, 8D / 16D,
            back().getInput() == 0 && front().getInput() == 0);
    RenderHelper.renderDigitalRedstoneTorch(-4 / 16D, 2D / 16D, 1 / 16D, 10D / 16D, front().getInput() > 0);
    RenderHelper.renderDigitalRedstoneTorch(2 / 16D, 2D / 16D, 6 / 16D, 10D / 16D, front().getInput() > 0);
    renderTop("right", mirrored ? left() : right());

    if (mirrored) {
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glPopMatrix();
    }
}

From source file:com.bluepowermod.part.lamp.PartCageLamp.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)/*from w w  w  .  j  ava2s  .c  om*/
public void renderGlow(int pass) {

    Vec3dCube vector = new Vec3dCube(5 / 16D, 2 / 16D, 5 / 16D, 11 / 16D, 11 / 16D, 11 / 16D).rotate(getFace(),
            Vec3d.center);

    double r = ((color.getHex() & 0xFF0000) >> 16) / 256D;
    double g = ((color.getHex() & 0x00FF00) >> 8) / 256D;
    double b = (color.getHex() & 0x0000FF) / 256D;

    if (pass == 1) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBegin(GL11.GL_QUADS);
        com.bluepowermod.client.render.RenderHelper.drawColoredCube(vector.clone().expand(0.5 / 16D), r, g, b,
                ((inverted ? 255 - (power & 0xFF) : (power & 0xFF)) / 255D) * 0.625);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDisable(GL11.GL_BLEND);
    }

}

From source file:com.bluepowermod.part.lamp.PartFixture.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)//from  ww  w  . j av  a 2s. com
public void renderGlow(int pass) {

    Vec3dCube vector = new Vec3dCube(3 / 16D, 2 / 16D, 3 / 16D, 1.0 - (3 / 16D), 8 / 16D, 13 / 16D)
            .rotate(getFace(), Vec3d.center);

    double r = ((color.getHex() & 0xFF0000) >> 16) / 256D;
    double g = ((color.getHex() & 0x00FF00) >> 8) / 256D;
    double b = (color.getHex() & 0x0000FF) / 256D;
    if (pass == 1) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glBegin(GL11.GL_QUADS);
        com.bluepowermod.client.render.RenderHelper.drawColoredCube(vector.clone().expand(0.5 / 16D), r, g, b,
                ((inverted ? 255 - (power & 0xFF) : (power & 0xFF)) / 255D) * 0.625);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDisable(GL11.GL_BLEND);
    }
}

From source file:com.bluepowermod.part.tube.TubeStack.java

License:Open Source License

@SideOnly(Side.CLIENT)
public void render(float partialTick) {
    if (renderMode == RenderMode.AUTO) {
        renderMode = Minecraft.getMinecraft().gameSettings.fancyGraphics ? RenderMode.NORMAL
                : RenderMode.REDUCED;// www  .  j ava 2s  . c o  m
    }
    final RenderMode finalRenderMode = renderMode;

    if (customRenderItem == null) {
        customRenderItem = new RenderItem() {

            @Override
            public boolean shouldBob() {

                return false;
            };

            @Override
            public byte getMiniBlockCount(ItemStack stack, byte original) {

                return finalRenderMode == RenderMode.REDUCED ? (byte) 1 : original;
            }
        };
        customRenderItem.setRenderManager(RenderManager.instance);

        renderedItem = new EntityItem(FMLClientHandler.instance().getWorldClient());
        renderedItem.hoverStart = 0.0F;
    }

    renderedItem.setEntityItemStack(stack);

    double renderProgress = (oldProgress + (progress - oldProgress) * partialTick) * 2 - 1;

    GL11.glPushMatrix();
    GL11.glTranslated(heading.offsetX * renderProgress * 0.5, heading.offsetY * renderProgress * 0.5,
            heading.offsetZ * renderProgress * 0.5);
    if (finalRenderMode != RenderMode.NONE) {
        GL11.glPushMatrix();
        if (stack.stackSize > 5) {
            GL11.glScaled(0.8, 0.8, 0.8);
        }
        if (!(stack.getItem() instanceof ItemBlock)) {
            GL11.glScaled(0.8, 0.8, 0.8);
            GL11.glTranslated(0, -0.15, 0);
        }

        customRenderItem.doRender(renderedItem, 0, 0, 0, 0, 0);
        GL11.glPopMatrix();
    } else {
        float size = 0.02F;
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glBegin(GL11.GL_QUADS);
        RenderHelper.drawColoredCube(new Vec3dCube(-size, -size, -size, size, size, size), 1, 1, 1, 1);
        GL11.glEnd();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
    }

    if (color != TubeColor.NONE) {

        float size = 0.2F;

        int colorInt = ItemDye.field_150922_c[color.ordinal()];
        float red = (colorInt >> 16) / 256F;
        float green = (colorInt >> 8 & 255) / 256F;
        float blue = (colorInt & 255) / 256F;

        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glColor3f(red, green, blue);
        Minecraft.getMinecraft().renderEngine
                .bindTexture(new ResourceLocation(Refs.MODID, "textures/blocks/tubes/inside_color_border.png"));
        RenderHelper.drawTesselatedTexturedCube(new Vec3dCube(-size, -size, -size, size, size, size));
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glEnable(GL11.GL_LIGHTING);
    }

    GL11.glPopMatrix();
}