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:buildcraft.builders.urbanism.RenderBoxProvider.java

License:Minecraft Mod Public

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();//from  w w  w  .  j a  v a2s . c om
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(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);

    GL11.glPushMatrix();
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glTranslated(x, y, z);

    if (tileentity instanceof IBoxesProvider) {
        for (Box b : ((IBoxesProvider) tileentity).getBoxes()) {
            if (b.isVisible) {
                RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
            }
        }
    } else if (tileentity instanceof IBoxProvider) {
        Box b = ((IBoxProvider) tileentity).getBox();

        if (b.isVisible) {
            RenderBox.doRender(TileEntityRendererDispatcher.instance.field_147553_e, getTexture(b.kind), b);
        }
    }

    GL11.glPopMatrix();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.core.gui.AdvancedSlot.java

License:Minecraft Mod Public

public void drawSprite(int cornerX, int cornerY) {
    Minecraft mc = Minecraft.getMinecraft();

    if (drawBackround) {
        mc.renderEngine.bindTexture(TEXTURE_SLOT);
        gui.drawTexturedModalRect(cornerX + x - 1, cornerY + y - 1, 0, 0, 18, 18);
    }/*from  w  w  w  .ja v  a  2s .co m*/

    if (!isDefined()) {
        return;
    }

    if (getItemStack() != null) {
        drawStack(getItemStack());
    } else if (getIcon() != null) {
        mc.renderEngine.bindTexture(getTexture());
        //System.out.printf("Drawing advanced sprite %s (%d,%d) at %d %d\n", getIcon().getIconName(), getIcon().getOriginX(),getIcon().getOriginY(),cornerX + x, cornerY + y);

        GL11.glDisable(GL11.GL_LIGHTING); // Make sure that render states are reset, an ItemStack can derp them up.
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);

        gui.drawTexturedModelRectFromIcon(cornerX + x, cornerY + y, getIcon(), 16, 16);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        GL11.glDisable(GL11.GL_BLEND);
    }

}

From source file:buildcraft.core.gui.GuiBuildCraft.java

License:Minecraft Mod Public

/**
 * Draws the screen and all the components in it.
 *//* w ww.  ja  va2  s .  co m*/
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
    super.drawScreen(mouseX, mouseY, par3);
    int left = this.guiLeft;
    int top = this.guiTop;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(left, top, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.disableStandardItemLighting();

    InventoryPlayer playerInv = this.mc.thePlayer.inventory;

    if (playerInv.getItemStack() == null) {
        drawToolTips(container.getWidgets(), mouseX, mouseY);
        drawToolTips(buttonList, mouseX, mouseY);
        drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY);
    }

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

From source file:buildcraft.core.lib.engines.RenderEngine.java

License:Minecraft Mod Public

private void render(float progress, ForgeDirection orientation, ResourceLocation baseTexture,
        ResourceLocation chamberTexture, ResourceLocation trunkTexture, double x, double y, double z) {
    if (BuildCraftCore.render == RenderMode.NoDynamic) {
        return;//from w w  w  . java2s .  c om
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glColor3f(1, 1, 1);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    float step;

    if (progress > 0.5) {
        step = 7.99F - (progress - 0.5F) * 2F * 7.99F;
    } else {
        step = progress * 2F * 7.99F;
    }

    float translatefact = step / 16;

    float[] angle = { 0, 0, 0 };
    float[] translate = { orientation.offsetX, orientation.offsetY, orientation.offsetZ };

    switch (orientation) {
    case EAST:
    case WEST:
    case DOWN:
        angle[2] = angleMap[orientation.ordinal()];
        break;
    case SOUTH:
    case NORTH:
    default:
        angle[0] = angleMap[orientation.ordinal()];
        break;
    }

    box.rotateAngleX = angle[0];
    box.rotateAngleY = angle[1];
    box.rotateAngleZ = angle[2];

    trunk.rotateAngleX = angle[0];
    trunk.rotateAngleY = angle[1];
    trunk.rotateAngleZ = angle[2];

    movingBox.rotateAngleX = angle[0];
    movingBox.rotateAngleY = angle[1];
    movingBox.rotateAngleZ = angle[2];

    chamber.rotateAngleX = angle[0];
    chamber.rotateAngleY = angle[1];
    chamber.rotateAngleZ = angle[2];

    float factor = (float) (1.0 / 16.0);

    bindTexture(baseTexture);

    box.render(factor);

    GL11.glTranslatef(translate[0] * translatefact, translate[1] * translatefact, translate[2] * translatefact);
    movingBox.render(factor);
    GL11.glTranslatef(-translate[0] * translatefact, -translate[1] * translatefact,
            -translate[2] * translatefact);

    bindTexture(chamberTexture);

    float chamberf = 2F / 16F;
    int chamberc = ((int) step + 4) / 2;

    for (int i = 0; i <= step + 2; i += 2) {
        chamber.render(factor);
        GL11.glTranslatef(translate[0] * chamberf, translate[1] * chamberf, translate[2] * chamberf);
    }

    GL11.glTranslatef(-translate[0] * chamberf * chamberc, -translate[1] * chamberf * chamberc,
            -translate[2] * chamberf * chamberc);

    bindTexture(trunkTexture);

    trunk.render(factor);

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.core.lib.gui.AdvancedSlot.java

License:Minecraft Mod Public

public void drawSprite(int cornerX, int cornerY) {
    Minecraft mc = Minecraft.getMinecraft();

    if (drawBackround) {
        mc.renderEngine.bindTexture(TEXTURE_SLOT);
        gui.drawTexturedModalRect(cornerX + x - 1, cornerY + y - 1, 0, 0, 18, 18);
    }/*  w w w  . j a  v  a2s. c o m*/

    if (!isDefined()) {
        return;
    }

    if (getItemStack() != null) {
        drawStack(getItemStack());
    } else if (getIcon() != null) {
        mc.renderEngine.bindTexture(getTexture());
        //System.out.printf("Drawing advanced sprite %s (%d,%d) at %d %d\n", getIcon().getIconName(), getIcon().getOriginX(),getIcon().getOriginY(),cornerX + x, cornerY + y);

        GL11.glPushAttrib(GL11.GL_LIGHTING_BIT | GL11.GL_COLOR_BUFFER_BIT);

        GL11.glDisable(GL11.GL_LIGHTING); // Make sure that render states are reset, an ItemStack can derp them up.
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        GL11.glEnable(GL11.GL_BLEND);

        gui.drawTexturedModelRectFromIcon(cornerX + x, cornerY + y, getIcon(), 16, 16);

        GL11.glPopAttrib();
    }

}

From source file:buildcraft.core.lib.gui.buttons.GuiImageButton.java

License:Minecraft Mod Public

@Override
public void drawButton(Minecraft minecraft, int x, int y) {
    if (!visible) {
        return;/*from  w ww  .  jav a2  s .  c o m*/
    }

    minecraft.renderEngine.bindTexture(texture);

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_BLEND);

    int buttonState = getButtonState(x, y);

    drawTexturedModalRect(xPosition, yPosition, baseU + buttonState * size, baseV, size, size);
    drawTexturedModalRect(xPosition + 1, yPosition + 1, u, v, size - 2, size - 2);

    mouseDragged(minecraft, x, y);
}

From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java

License:Minecraft Mod Public

protected void drawSlotHighlight(AdvancedSlot slot, int mouseX, int mouseY) {
    if (this.isMouseOverSlot(slot, mouseX, mouseY) && slot.shouldDrawHighlight()) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glColorMask(true, true, true, false);
        this.drawGradientRect(guiLeft + slot.x, guiTop + slot.y, guiLeft + slot.x + 16, guiTop + slot.y + 16,
                -2130706433, -2130706433);
        GL11.glColorMask(true, true, true, true);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }//  w  ww . java2s . c o  m
}

From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java

License:Minecraft Mod Public

public void drawStack(ItemStack item, int x, int y) {
    Minecraft mc = Minecraft.getMinecraft();

    if (item != null) {
        GL11.glEnable(GL11.GL_LIGHTING);
        float prevZ = GuiAdvancedInterface.getItemRenderer().zLevel;
        GuiAdvancedInterface.getItemRenderer().zLevel = 200F;
        GuiAdvancedInterface.getItemRenderer().renderItemAndEffectIntoGUI(getFontRenderer(), mc.renderEngine,
                item, x, y);//www.  j a v  a2s  . co m
        GuiAdvancedInterface.getItemRenderer().renderItemOverlayIntoGUI(getFontRenderer(), mc.renderEngine,
                item, x, y);
        GuiAdvancedInterface.getItemRenderer().zLevel = prevZ;
        GL11.glDisable(GL11.GL_LIGHTING);
    }
}

From source file:buildcraft.core.lib.gui.GuiBuildCraft.java

License:Minecraft Mod Public

/**
 * Draws the screen and all the components in it.
 *//*from  w w  w . j  a  v  a 2s .  c om*/
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
    super.drawScreen(mouseX, mouseY, par3);
    int left = this.guiLeft;
    int top = this.guiTop;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(left, top, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.disableStandardItemLighting();

    InventoryPlayer playerInv = this.mc.thePlayer.inventory;

    if (playerInv.getItemStack() == null) {
        drawToolTips(container.getWidgets(), mouseX - left, mouseY - top, left, top);
        drawToolTips(buttonList, mouseX, mouseY, 0, 0);
        drawToolTips(inventorySlots.inventorySlots, mouseX, mouseY, 0, 0);
    }

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

From source file:buildcraft.core.lib.render.FluidRenderer.java

License:Minecraft Mod Public

public static int[] getFluidDisplayLists(FluidStack fluidStack, World world, boolean flowing) {
    if (fluidStack == null) {
        return null;
    }/*from w w  w  .  j  av a2s  . c om*/
    Fluid fluid = fluidStack.getFluid();
    if (fluid == null) {
        return null;
    }
    Map<Fluid, int[]> cache = flowing ? flowingRenderCache : stillRenderCache;
    int[] diplayLists = cache.get(fluid);
    if (diplayLists != null) {
        return diplayLists;
    }

    diplayLists = new int[DISPLAY_STAGES];

    if (fluid.getBlock() != null) {
        liquidBlock.baseBlock = fluid.getBlock();
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    } else {
        liquidBlock.baseBlock = Blocks.water;
        liquidBlock.texture = getFluidTexture(fluidStack, flowing);
    }

    cache.put(fluid, diplayLists);

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int s = 0; s < DISPLAY_STAGES; ++s) {
        diplayLists[s] = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(diplayLists[s], 4864 /*GL_COMPILE*/);

        liquidBlock.minX = 0.01f;
        liquidBlock.minY = 0;
        liquidBlock.minZ = 0.01f;

        liquidBlock.maxX = 0.99f;
        liquidBlock.maxY = Math.max(s, 1) / (float) DISPLAY_STAGES;
        liquidBlock.maxZ = 0.99f;

        RenderEntityBlock.INSTANCE.renderBlock(liquidBlock);

        GL11.glEndList();
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    return diplayLists;
}