Example usage for org.lwjgl.opengl GL11 glEnable

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

Introduction

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

Prototype

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

Source Link

Document

Enables the specified OpenGL state.

Usage

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();//from w ww .  j  a va  2s.c  om
    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;//  www  .  j  a v  a2 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  .  j ava 2s  . c o  m*/
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)/*from ww w. j a  v  a2 s . c om*/
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)/*  w  w  w  . j  a  v  a  2 s  .com*/
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  w w w.  ja  va  2s  . c  o m*/
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;//from  ww  w. j a v a  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();
}

From source file:com.bossletsplays.duthorix.utils.Util.java

License:Apache License

public static void enableCulling() {
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:com.bossletsplays.duthorix.utils.Util.java

License:Apache License

public static void disableWireframe() {
    GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
}

From source file:com.builtbroken.assemblyline.content.rail.carts.RenderCart.java

/**
 * Renders the bounding box around the cart
 *
 * @param cart//from   www. j a  v  a2s  . co  m
 * @param xx
 * @param yy
 * @param zz
 */
protected void drawBounds(EntityAbstractCart cart, double xx, double yy, double zz) {
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    float halfWidth = cart.width / 2.0F;
    float halfLength = cart.length / 2.0F;
    float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw));
    if (yaw >= 45 && yaw <= 135) {
        halfWidth = cart.length / 2.0F;
        halfLength = cart.width / 2.0F;
    }

    AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(xx - halfWidth, yy, zz - halfLength,
            xx + halfWidth, yy + (double) cart.height, zz + halfLength);
    RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
}