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:cn.lambdacraft.crafting.block.crafter.GuiElectricCrafter.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();/*from   w  w w . j av  a2 s .  c  om*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderUtils.loadTexture(ClientProps.GUI_ELCRAFTER_PATH);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int height = tileEntity.heatForRendering * 46 / tileEntity.maxHeat;
    if (height > 0) {
        drawTexturedModalRect(x + 138, y + 63 - height, 181, 0, 6, height);
    }
    height = tileEntity.currentEnergy * 46 / TileElCrafter.MAX_STORAGE;
    if (height > 0) {
        drawTexturedModalRect(x + 116, y + 63 - height, 174, 0, 6, height);
    }
    if (tileEntity.isCrafting && tileEntity.currentRecipe != null) {
        if (tileEntity.heatRequired > 0) {
            height = tileEntity.heatRequired * 46 / tileEntity.maxHeat;
            drawTexturedModalRect(x + 136, y + 63 - height, 207, 1, 6, 3);
        }
    }

    this.drawElements(i, j);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.gui.GuiBatBox.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();/*w  w  w .j av  a 2 s.  c  o m*/
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(ClientProps.GUI_BATBOX_PATH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);

    if (te.currentEnergy > 0) {
        int len = te.currentEnergy * 68 / te.maxStorage;
        this.drawTexturedModalRect(x + 53, y + 38, 173, 10, len, 7);
    }

    this.drawElements();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.gui.GuiElectricCrafter.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();//ww  w .j  a  va  2s .com
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(ClientProps.GUI_ELCRAFTER_PATH);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int height = tileEntity.heatForRendering * 46 / tileEntity.maxHeat;
    if (height > 0) {
        drawTexturedModalRect(x + 138, y + 63 - height, 181, 0, 6, height);
    }
    height = tileEntity.currentEnergy * 46 / TileElCrafter.MAX_STORAGE;
    if (height > 0) {
        drawTexturedModalRect(x + 116, y + 63 - height, 174, 0, 6, height);
    }
    if (tileEntity.isCrafting && tileEntity.currentRecipe != null) {
        if (tileEntity.heatRequired > 0) {
            height = tileEntity.heatRequired * 46 / tileEntity.maxHeat;
            drawTexturedModalRect(x + 136, y + 63 - height, 207, 1, 6, 3);
        }
    }
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.gui.GuiGenFire.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();// w ww  .  jav  a2 s  . co m
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(ClientProps.GUI_GENFIRE_PATH);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int len = 0;
    if (te.maxBurnTime > 0) {
        len = te.tickLeft * 39 / te.maxBurnTime;
        this.drawTexturedModalRect(x + 109, y + 52, 173, 0, len, 3);
    }
    len = te.currentEnergy * 50 / te.maxStorage;
    if (len > 0)
        this.drawTexturedModalRect(x + 75, y + 65 - len, 173, 55 - len, 14, len);
    this.drawElements();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.gui.GuiGenLava.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();/*from  w w w  . j a va2 s  .c  o  m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(ClientProps.GUI_GENLAVA_PATH);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int len = 0;
    len = te.bucketCnt * 47 / te.maxStorage;
    len += Math.round(2.35F * te.currentEnergy / TileGeneratorLava.ENERGY_PER_BUCKET);
    this.drawTexturedModalRect(x + 91, y + 65 - len, 173, 59 - len, 6, len);
    this.drawElements();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.gui.GuiGenSolar.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glPushMatrix();/*from  w w w  .  ja va2  s  . co m*/
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    bindTexture(ClientProps.GUI_GENSOLAR_PATH);
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
    int len = 0;
    len = te.currentEnergy * 48 / te.maxStorage;
    if (len > 0)
        this.drawTexturedModalRect(x + 24, y + 52, 174, 70, len, 7);
    if (te.worldObj.isDaytime()) {
        this.drawTexturedModalRect(x + 13, y + 19, 173, 0, 60, 30);
        this.drawTexturedModalRect(x + 86, y + 44, 186, 9, 5, 5);
    } else {
        this.drawTexturedModalRect(x + 13, y + 19, 173, 34, 60, 30);
        this.drawTexturedModalRect(x + 86, y + 44, 186, 44, 5, 5);
    }
    this.drawElements();
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.crafting.client.renderer.RenderWire.java

License:Open Source License

private void renderWireBox(Tessellator t, int side, boolean[] theArray) {
    ForgeDirection[] dirs = ForgeDirection.values();
    Vec3 v1 = RenderUtils.newV3(-WIDTH, -WIDTH, -WIDTH), v2 = RenderUtils.newV3(WIDTH, -WIDTH, -WIDTH),
            v3 = RenderUtils.newV3(WIDTH, -WIDTH, WIDTH), v4 = RenderUtils.newV3(-WIDTH, -WIDTH, WIDTH),
            v5 = RenderUtils.newV3(-WIDTH, WIDTH, -WIDTH), v6 = RenderUtils.newV3(WIDTH, WIDTH, -WIDTH),
            v7 = RenderUtils.newV3(WIDTH, WIDTH, WIDTH), v8 = RenderUtils.newV3(-WIDTH, WIDTH, WIDTH);
    GL11.glPushMatrix();//from   w w  w  .  j a  v a2s .co m
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float dx = 0.0F, dy = 0.0F, dz = 0.0F;
    switch (side) {
    case 0:
        dy = -1;
        break;
    case 1:
        dy = 1;
        break;
    case 4:
        dx = -1;
        break;
    case 5:
        dx = 1;
        break;
    case 2:
        dz = -1;
        break;
    case 3:
        dz = 1;
        break;
    }
    float offset = (0.5F + WIDTH) / 2F;
    GL11.glTranslatef(dx * offset, dy * offset, dz * offset);
    if (side != -1) {
        float scale = 2F;
        GL11.glScalef(Math.abs(dx == 0.0F ? 1 : dx * scale), Math.abs(dy == 0.0F ? 1 : dy * scale),
                Math.abs(dz == 0.0F ? 1 : dz * scale));
    }
    int a = 0;
    for (int i = 0; i < theArray.length; i++)
        if (theArray[i])
            a++;
    for (int i = 0; i < 6; i++) {
        if (!doesRenderSide(side, i, theArray))
            continue;
        Vec3 vec1 = null, vec2 = null, vec3 = null, vec4 = null;
        dx = 0.0F;
        dy = 0.0F;
        dz = 0.0F;
        switch (i) {
        case 0:
            vec1 = v4;
            vec2 = v3;
            vec3 = v2;
            vec4 = v1;
            dy = -1.0F;
            break;
        case 1:
            vec1 = v5;
            vec2 = v6;
            vec3 = v7;
            vec4 = v8;
            dy = 1.0F;
            break;
        case 4:
            vec1 = v1;
            vec2 = v5;
            vec3 = v8;
            vec4 = v4;
            dx = -1.0F;
            break;
        case 5:
            vec1 = v2;
            vec2 = v3;
            vec3 = v7;
            vec4 = v6;
            dx = 1.0F;
            break;
        case 2:
            vec1 = v1;
            vec2 = v2;
            vec3 = v6;
            vec4 = v5;
            dz = -1.0F;
            break;
        case 3:
            vec1 = v4;
            vec2 = v8;
            vec3 = v7;
            vec4 = v3;
            dz = 1.0F;
            break;
        }
        GL11.glPushMatrix();
        if (side == -1) {
            if (a == 1 && theArray[dirs[i].getOpposite().ordinal()])
                RenderUtils.loadTexture(ClientProps.WIRE_MAIN_PATH);
            else
                RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH);
        } else {
            RenderUtils.loadTexture(ClientProps.WIRE_SIDE_PATH2);
        }

        t.startDrawingQuads();
        t.setNormal(dx, dy, dz);
        RenderUtils.addVertex(vec4, 0.0, 1.0);
        RenderUtils.addVertex(vec3, 1.0, 1.0);
        RenderUtils.addVertex(vec2, 1.0, 0.0);
        RenderUtils.addVertex(vec1, 0.0, 0.0);
        t.draw();
        GL11.glPopMatrix();
    }
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java

License:Open Source License

public static void drawPlayerHud(EntityPlayer player, ScaledResolution resolution, float partialTickTime) {

    int k = resolution.getScaledWidth();
    int l = resolution.getScaledHeight();
    int i2 = k / 2 - 91;
    int k2 = l - 32 + 3;
    Minecraft mc = Minecraft.getMinecraft();
    TextureManager engine = mc.renderEngine;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    engine.bindTexture(ClientProps.HEV_HUD_PATH);

    GL11.glPushMatrix();/*from   w ww. j a  va 2s  .  co m*/

    double scale = 0.00026 * mc.displayWidth + 0.3;

    float xOffset, yOffset;
    xOffset = 10;
    yOffset = l - 20;
    GL11.glTranslatef(xOffset, yOffset, 0.0F);

    GL11.glScaled(scale, scale, 1.0);
    //Health Section
    HudUtils.setTextureResolution(TEX_WIDTH, TEX_HEIGHT);

    GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F);
    HudUtils.drawTexturedModalRect(0, 0, 64, 64, 24, 24, 64, 64);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    int h = (int) (player.getHealth() * 16 / 20);
    HudUtils.drawTexturedModalRect(0, 24 - (int) (h * 1.5), 192, 128 - 4 * h, 24, (int) (1.5 * h), 64, 4 * h);
    if (player.getHealth() <= 5)
        GL11.glColor4f(0.9F, 0.1F, 0.1F, 0.6F);
    drawNumberAt((byte) (player.getHealth() * 5), 18, 0);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.9F);

    //Armor Section
    GL11.glColor4f(0.7F, 0.7F, 0.7F, 0.6F);
    HudUtils.drawTexturedModalRect(70, 0, 0, 64, 24, 24, 64, 64);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.6F);
    h = player.getTotalArmorValue() * 16 / 20;
    if (h > 16)
        h = 16;
    HudUtils.drawTexturedModalRect(70, 24 - (int) (h * 1.5), 128, 128 - 4 * h, 24, (int) (h * 1.5), 64, 4 * h);

    drawNumberAt(player.getTotalArmorValue() * 5, 70 + 12, 0);

    GL11.glPopMatrix();

    //Other section
    drawArmorTip(player, engine, k, l);
    if (LCClientPlayer.drawArmorTip)
        drawWeaponTip(player, engine, k, l);

    engine.bindTexture(engine.getResourceLocation(1));
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.7F);
}

From source file:cn.lambdacraft.deathmatch.client.HEVRenderingUtils.java

License:Open Source License

public static void drawCrosshair(ItemStack stack, int k, int l) {
    String xhairPath = null;//from  w w  w . j  a  v a  2  s . c  o m
    TextureManager engine = Minecraft.getMinecraft().renderEngine;
    int h = 12;
    if (stack != null) {
        if (stack.getItem() instanceof ISpecialCrosshair) {
            h = ((ISpecialCrosshair) stack.getItem()).getHalfWidth();
            int i = ((ISpecialCrosshair) stack.getItem()).getCrosshairID(stack);
            if (i >= 0)
                xhairPath = ClientProps.xhair_path + "xhair" + i + ".png";
        } else
            xhairPath = ClientProps.getCrosshairPath(stack.getItem().getUnlocalizedName(stack));

        if (xhairPath == null)
            xhairPath = ClientProps.DEFAULT_XHAIR_PATH;
    } else {
        xhairPath = ClientProps.DEFAULT_XHAIR_PATH;
    }
    GL11.glPushMatrix();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int par1 = k / 2 - h, par2 = l / 2 - h;
    RenderUtils.loadTexture(xhairPath);
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.setColorRGBA(ClientProps.xHairR, ClientProps.xHairG, ClientProps.xHairB, 255);
    t.addVertexWithUV(par1 + 0, par2 + 2 * h, -90, 0, 1);
    t.addVertexWithUV(par1 + 2 * h, par2 + 2 * h, -90, 1, 1);
    t.addVertexWithUV(par1 + 2 * h, par2 + 0, -90, 1, 0);
    t.addVertexWithUV(par1 + 0, par2 + 0, -90, 0, 0);
    t.draw();

    //TODO: maybe buggy here
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(1.0F, 0.5F, 0.0F, 0.7F);
    GL11.glPopMatrix();
    engine.bindTexture(Gui.icons);
}

From source file:cn.lambdacraft.mob.client.renderer.RenderAlienSlave.java

License:Open Source License

private void renderElectro(EntityAlienSlave ent, Vec3 vec3, Tessellator t, double x, double y, double z,
        boolean isLeft) {
    double dx = vec3.xCoord, dy = vec3.yCoord, dz = vec3.zCoord;
    double tx = 0.0, ty = 1.2, tz = 0.0;
    GL11.glPushMatrix();/*  w  ww .ja va  2  s  .c o m*/
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderUtils.loadTexture(ClientProps.VORTIGAUNT_RAY_PATH[rand.nextInt(3)]);

    Vec3 v1 = RenderUtils.newV3(tx - WIDTH, ty, tz), v2 = RenderUtils.newV3(tx + WIDTH, ty, tz),
            v3 = RenderUtils.newV3(tx, ty - WIDTH, tz), v4 = RenderUtils.newV3(tx, ty + WIDTH, tz);
    double d = Math.sqrt(dx * dx + dy * dy + dz * dz) * 1.3;

    GL11.glTranslated(x, y, z);

    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
    t.startDrawingQuads();
    t.setBrightness(15728880);
    t.setColorRGBA_F(0.1F, 0.9F, 0.1F, 0.7F);
    RenderUtils.addVertex(v1, 0, 0);
    RenderUtils.addVertex(v2, 1, 0);
    RenderUtils.addVertex(v2.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v1.addVector(dx, dy, dz), 0, d);

    RenderUtils.addVertex(v3, 0, 0);
    RenderUtils.addVertex(v4, 1, 0);
    RenderUtils.addVertex(v4.addVector(dx, dy, dz), 1, d);
    RenderUtils.addVertex(v3.addVector(dx, dy, dz), 0, d);
    t.draw();

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

}