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.itszuvalex.femtocraft.research.gui.GuiResearchConsole.java

License:Open Source License

@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
    int k = (this.width - xSize) / 2;
    int l = (this.height - ySize) / 2;
    this.drawTexturedModalRect(k, l, 0, 0, xSize, ySize);

    int progress = console.getResearchProgressScaled(78);
    this.drawTexturedModalRect(k + 64, l + 65, 0, 166, progress, 6);

    if (console.displayTech() != null || console.isResearching()) {

        String name;/*from   w  w w  .j  a  v  a2  s.c om*/

        if (console.isResearching()) {
            name = console.getResearchingName();
        } else {
            name = console.displayTech();
        }

        ITechnology tech = Femtocraft.researchManager().getTechnology(name);
        if (tech != null) {

            String s = tech.getName();
            this.fontRendererObj.drawString(s, k + 71 + (165 - 71 - this.fontRendererObj.getStringWidth(s)) / 2,
                    l + 20, FemtocraftUtils.colorFromARGB(255, 255, 255, 255));

            if (console.isResearching()) {
                s = String.format("%d%s", console.getResearchProgressScaled(100), "%");
                this.fontRendererObj.drawString(s, k + 168 - this.fontRendererObj.getStringWidth(s), l + 40,
                        FemtocraftUtils.colorFromARGB(255, 255, 255, 255));
            } else {
                s = "Begin";
                this.fontRendererObj.drawString(s, k + 85 - this.fontRendererObj.getStringWidth(s) / 2,
                        l + 36 + (52 - 36 - this.fontRendererObj.FONT_HEIGHT) / 2,
                        FemtocraftUtils.colorFromARGB(255, 255, 255, 255));
            }

            RenderItem render = new RenderItem();
            GL11.glDisable(GL11.GL_BLEND); //Forge: Cleanup states we set.
            GL11.glDisable(GL11.GL_LIGHTING); //Forge: Make sure Lighting is disabled. Fixes MC-33065
            GL11.glEnable(GL11.GL_CULL_FACE);
            RenderHelper.enableGUIStandardItemLighting();
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            GL11.glEnable(GL11.GL_COLOR_MATERIAL);
            render.renderItemAndEffectIntoGUI(fontRendererObj, Minecraft.getMinecraft().getTextureManager(),
                    tech.getDisplayItem(), k + 110, l + 33);
            RenderHelper.disableStandardItemLighting();
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        }

    }
}

From source file:com.jmanpenilla.carbonmod.client.render.item.RenderCompressionChamberItem.java

License:LGPL

private static void renderCompressionChamber(float x, float y, float z, float scale) {
    GL11.glPushMatrix();//from  w w w  .  ja  v  a  2  s  .co m

    // Disable Lighting Calculations
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glTranslatef(x, y, z);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);

    GL11.glScalef(scale, scale, scale);
    GL11.glRotatef(180f, 0f, 0f, 1f);

    RenderCompressionChamber.model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    // Re-enable Lighting Calculations
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:com.jmex.bui.BComponent.java

License:Open Source License

/**
 * Restores the previous scissor state after a call to {@link #intersectScissorBox}.
 *
 * @param enabled the value returned by {@link #intersectScissorBox}, indicating whether or not
 *                scissoring was enabled
 * @param rect    the scissor box to restore
 *//*from w ww.j  av  a  2 s  .co m*/
protected static void restoreScissorState(boolean enabled, Rectangle rect) {
    if (enabled) {
        GL11.glScissor(rect.x, rect.y, rect.width, rect.height);
    } else {
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
    }
}

From source file:com.kanbekotori.keycraft.renderer.RenderJavelin.java

License:Open Source License

public void doRender(EntityJavelin entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
    this.bindEntityTexture(entity);
    GL11.glPushMatrix();/*from   w w w. j  a  v a  2 s  . c o  m*/
    GL11.glTranslated(x, y, z);
    //
    GL11.glTranslatef(0.0F, entity.height / 2.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationYaw - 90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(entity.prevRotationPitch, 0.0F, 0.0F, 1.0F);

    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);

    float f10 = 0.05625F;
    GL11.glScalef(f10, f10, f10);
    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, f10);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-3.25D, -0.5D, 0.0D, 1.0D / 16.0D, 14.0D / 16.0D); // 
        tessellator.addVertexWithUV(3.25D, -0.5D, 0.0D, 14.0D / 16.0D, 1.0D / 16.0D); // 
        tessellator.addVertexWithUV(3.25D, 0.5D, 0.0D, 16.0D / 16.0D, 3.0D / 16.0D); // 
        tessellator.addVertexWithUV(-3.25D, 0.5D, 0.0D, 3.0D / 16.0D, 16.0D / 16.0D); // 
        tessellator.draw();
    }

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

From source file:com.kegare.caveworld.client.config.GuiSelectBiome.java

License:Minecraft Mod Public

@Override
public void drawScreen(int mouseX, int mouseY, float ticks) {
    biomeList.drawScreen(mouseX, mouseY, ticks);

    drawCenteredString(fontRendererObj, I18n.format(Caveworld.CONFIG_LANG + "select.biome"), width / 2, 15,
            0xFFFFFF);//from   w  w  w  .  j ava  2 s  .  co m

    super.drawScreen(mouseX, mouseY, ticks);

    GL11.glDisable(GL11.GL_LIGHTING);
    filterTextField.drawTextBox();

    if (detailHoverChecker.checkHover(mouseX, mouseY)) {
        func_146283_a(fontRendererObj.listFormattedStringToWidth(
                I18n.format(Caveworld.CONFIG_LANG + "detail.hover"), 300), mouseX, mouseY);
    } else if (instantHoverChecker.checkHover(mouseX, mouseY)) {
        func_146283_a(fontRendererObj.listFormattedStringToWidth(
                I18n.format(Caveworld.CONFIG_LANG + "instant.hover"), 300), mouseX, mouseY);
    } else if (biomeList.func_148141_e(mouseY) && isCtrlKeyDown()) {
        BiomeGenBase biome = biomeList.contents.get(biomeList.func_148124_c(mouseX, mouseY), null);

        if (biome != null) {
            List<String> info;

            if (!hoverCache.containsKey(biome)) {
                ICaveBiome entry = CaveworldAPI.getCaveBiome(biome);

                info = Lists.newArrayList();
                info.add(EnumChatFormatting.DARK_GRAY + Integer.toString(biome.biomeID) + ": "
                        + biome.biomeName);
                info.add(EnumChatFormatting.GRAY + I18n.format(Caveworld.CONFIG_LANG + "biomes.genWeight")
                        + ": " + entry.getGenWeight());
                info.add(EnumChatFormatting.GRAY + I18n.format(Caveworld.CONFIG_LANG + "biomes.terrainBlock")
                        + ": "
                        + GameData.getBlockRegistry().getNameForObject(entry.getTerrainBlock().getBlock())
                        + ", " + entry.getTerrainBlock().getMetadata());

                Block block = biome.topBlock;

                if (block != null) {
                    info.add(EnumChatFormatting.GRAY
                            + I18n.format(Caveworld.CONFIG_LANG + "select.biome.info.topBlock") + ": "
                            + GameData.getBlockRegistry().getNameForObject(block));
                }

                block = biome.fillerBlock;

                if (block != null) {
                    info.add(EnumChatFormatting.GRAY
                            + I18n.format(Caveworld.CONFIG_LANG + "select.biome.info.fillerBlock") + ": "
                            + GameData.getBlockRegistry().getNameForObject(block));
                }

                info.add(EnumChatFormatting.GRAY
                        + I18n.format(Caveworld.CONFIG_LANG + "select.biome.info.temperature") + ": "
                        + biome.temperature);
                info.add(EnumChatFormatting.GRAY
                        + I18n.format(Caveworld.CONFIG_LANG + "select.biome.info.rainfall") + ": "
                        + biome.rainfall);

                if (BiomeDictionary.isBiomeRegistered(biome)) {
                    Set<String> types = Sets.newTreeSet();

                    for (Type type : BiomeDictionary.getTypesForBiome(biome)) {
                        types.add(type.name());
                    }

                    info.add(EnumChatFormatting.GRAY
                            + I18n.format(Caveworld.CONFIG_LANG + "select.biome.info.type") + ": "
                            + Joiner.on(", ").skipNulls().join(types));
                }

                hoverCache.put(biome, info);
            }

            info = hoverCache.get(biome);

            if (!info.isEmpty()) {
                func_146283_a(info, mouseX, mouseY);
            }
        }
    }

    if (!biomeList.selected.isEmpty()) {
        if (mouseX <= 100 && mouseY <= 20) {
            drawString(fontRendererObj,
                    I18n.format(Caveworld.CONFIG_LANG + "select.biome.selected", biomeList.selected.size()), 5,
                    5, 0xEFEFEF);
        }

        if (selectedHoverChecker.checkHover(mouseX, mouseY)) {
            List<String> biomes = Lists.newArrayList();

            for (BiomeGenBase selected : biomeList.selected) {
                biomes.add(String.format("%d: %s", selected.biomeID, selected.biomeName));
            }

            func_146283_a(biomes, mouseX, mouseY);
        }
    }
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();/*from ww  w.j a va  2  s  .  c  o m*/
    GL11.glLoadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GL11.glPushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GL11.glTranslatef(f1, f2, f3);
        GL11.glRotatef(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-(panoramaTimer + ticks) * 0.1F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GL11.glPushMatrix();

            if (l == 1) {
                GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 2) {
                GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 3) {
                GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            }

            if (l == 4) {
                GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            }

            if (l == 5) {
                GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
            }

            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(16777215, 255 / (k + 1));
            float f4 = 0.0F;
            tessellator.addVertexWithUV(-1.0D, -1.0D, 1.0D, 0.0F + f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, -1.0D, 1.0D, 1.0F - f4, 0.0F + f4);
            tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f4, 1.0F - f4);
            tessellator.addVertexWithUV(-1.0D, 1.0D, 1.0D, 0.0F + f4, 1.0F - f4);
            tessellator.draw();
            GL11.glPopMatrix();
        }

        GL11.glPopMatrix();
        GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GL11.glEnable(GL11.GL_BLEND);/*from  w w  w  .  j  ava  2 s .c o  m*/
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glColorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (i + 1));
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        tessellator.addVertexWithUV(j, k, 0.0F, 0.0F + f1, 1.0D);
        tessellator.addVertexWithUV(j, 0.0D, 0.0F, 1.0F + f1, 1.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F, 1.0F + f1, 0.0D);
        tessellator.addVertexWithUV(0.0D, k, 0.0F, 0.0F + f1, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColorMask(true, true, true, true);
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

@Override
protected void drawContainerBackground(Tessellator tessellator) {
    if (mc.theWorld != null) {
        Gui.drawRect(left, top, right, bottom, 0x101010);
    } else if (getPanoramaPaths() != null) {
        ++panoramaTimer;/*  www.  ja v  a 2s .c om*/

        GL11.glDisable(GL11.GL_ALPHA_TEST);
        renderSkybox(panoramaTicks);
        GL11.glEnable(GL11.GL_ALPHA_TEST);
    } else
        super.drawContainerBackground(tessellator);
}

From source file:com.kegare.caveworld.client.renderer.RenderCaveman.java

License:Minecraft Mod Public

@Override
public void doRender(Entity entity, double par2, double par3, double par4, float par5, float par6) {
    super.doRender(entity, par2, par3, par4, par5, par6);

    if (Config.cavemanShowHealthBar && entity instanceof EntityCaveman) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        EntityPlayer player = mc.thePlayer;
        EntityCaveman living = (EntityCaveman) entity;

        if (living.isTamed()
                && player.getGameProfile().getId().toString()
                        .equals(Strings.nullToEmpty(living.func_152113_b()))
                && living.getEntitySenses().canSee(player) && living.getDistanceToEntity(player) <= 3.5F
                && mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY
                && mc.objectMouseOver.entityHit == living) {
            float scale = 0.01666667F * 1.5F;
            int width = 15;
            double top = 5.0D;
            double under = top + 2.0D;

            GL11.glPushMatrix();/*from w  ww  .  j  a  v  a  2s.co m*/
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glTranslatef((float) par2, (float) par3 + 2.3F, (float) par4);
            GL11.glNormal3f(0.0F, 1.0F, 0.0F);
            GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
            GL11.glScalef(-scale, -scale, scale);
            GL11.glDisable(GL11.GL_LIGHTING);
            GL11.glTranslatef(0.0F, (living.isSittingAndStopped() ? 0.6F : 0.12F) / scale, 0.0F);
            GL11.glDepthMask(false);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(770, 771);

            int x = living.getBrightnessForRender((float) par2);
            int y = x % 65536;
            int z = x / 65536;

            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, y / 1.0F, z / 1.0F);
            Tessellator tessellator = Tessellator.instance;
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_I(0, 115);
            tessellator.addVertex(-width - 1, top - 0.5D, 0.0D);
            tessellator.addVertex(-width - 1, under + 0.5D, 0.0D);
            tessellator.addVertex(width + 1, under + 0.5D, 0.0D);
            tessellator.addVertex(width + 1, top - 0.5D, 0.0D);
            tessellator.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_BLEND);
            GL11.glDepthMask(true);

            Tessellator tessellator1 = Tessellator.instance;
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            float max = living.getMaxHealth();
            int health = (int) (2.0D * width * living.getHealth() / max);

            if (renderHealth < 0.0D) {
                renderHealth = health;
            } else {
                double dh = renderHealth - health;
                double distance = Math.abs(Math.sqrt(dh * dh));

                if ((int) renderHealth < health) {
                    if (distance > 10.0D) {
                        renderHealth += 0.35D;
                    } else if (distance < 1.5D) {
                        renderHealth += 0.01D;
                    } else {
                        renderHealth += 0.1D;
                    }
                } else if ((int) renderHealth > health) {
                    if (distance > 10.0D) {
                        renderHealth -= 0.35D;
                    } else if (distance < 1.5D) {
                        renderHealth -= 0.01D;
                    } else {
                        renderHealth -= 0.1D;
                    }
                }
            }

            int color = Color.GREEN.getRGB();

            if (renderHealth < max / 4) {
                color = Color.RED.getRGB();
            } else if (renderHealth < max / 2) {
                color = Color.YELLOW.getRGB();
            }

            tessellator1.startDrawingQuads();
            tessellator1.setColorRGBA_I(color, 145);
            tessellator1.addVertex(-width, top, 0.0D);
            tessellator1.addVertex(-width, under, 0.0D);
            tessellator1.addVertex(-width + renderHealth, under, 0.0D);
            tessellator1.addVertex(-width + renderHealth, top, 0.0D);
            tessellator1.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);

            GL11.glDisable(GL11.GL_BLEND);
            GL11.glEnable(GL11.GL_LIGHTING);
            GL11.glPopMatrix();
        } else {
            renderHealth = -1.0D;
        }
    }
}

From source file:com.kegare.caveworld.client.renderer.RenderMiningPickaxe.java

License:Minecraft Mod Public

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    FontRenderer renderer = item.getItem().getFontRenderer(item);

    if (renderer == null) {
        renderer = mc.fontRenderer;/* ww w .ja v a 2s .  c  o m*/
    }

    itemRender.renderItemIntoGUI(renderer, mc.getTextureManager(), item, 0, 0, true);

    Item base = ((ItemMiningPickaxe) item.getItem()).getBaseTool(item);

    if (base != CaveItems.mining_pickaxe) {
        GL11.glPushMatrix();
        GL11.glTranslatef(-9.0F, 14.0F, -9.0F);
        GL11.glScalef(0.6F, 0.6F, 0.6F);
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        itemRender.renderItemIntoGUI(renderer, mc.getTextureManager(), new ItemStack(base), 0,
                item.isItemDamaged() ? 13 : 16, true);
        GL11.glPopMatrix();
    }

    String refined = Roman.toRoman(((ItemMiningPickaxe) item.getItem()).getRefined(item));

    if (!Strings.isNullOrEmpty(refined)) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPushMatrix();
        GL11.glTranslatef(5.0F, 5.0F, 5.0F);
        GL11.glScalef(0.8F, 0.8F, 0.8F);
        renderer.drawStringWithShadow(refined, 16 - renderer.getStringWidth(refined) - 2,
                item.isItemDamaged() ? 3 : 6, 0xEEEEEE);
        GL11.glPopMatrix();
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
}