List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:buildcraft.commander.GuiZonePlan.java
License:Minecraft Mod Public
@Override protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { super.drawGuiContainerBackgroundLayer(f, x, y); mapXMin = (width - getContainer().mapTexture.width) / 2; if (getContainer().mapTexture.height <= 200) { mapYMin = guiTop + 20;/* w w w . j av a2 s. co m*/ } else { mapYMin = (height - getContainer().mapTexture.height) / 2; } getContainer().mapTexture.drawMap(mapXMin, mapYMin, zLevel); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); currentSelection.drawMap(mapXMin, mapYMin, zLevel); GL11.glPopAttrib(); newSelection.updateDynamicTexture(); if (inSelection && selX2 != 0) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_BLEND); int x1 = selX1 < selX2 ? selX1 : selX2; int x2 = selX1 < selX2 ? selX2 : selX1; int y1 = selY1 < selY2 ? selY1 : selY2; int y2 = selY1 < selY2 ? selY2 : selY1; drawTexturedModalRect(x1, y1, 0, 0, x2 - x1 + 1, y2 - y1 + 1); GL11.glPopAttrib(); } if (getContainer().mapTexture.height <= 200) { drawBackgroundSlots(); bindTexture(texture); drawTexturedModalRect(guiLeft + colorSelected.x, guiTop + colorSelected.y, 0, 220, 16, 16); drawTexturedModalRect(guiLeft + 236, guiTop + 38, 16, 220, 8, (int) ((zonePlan.progress / (float) TileZonePlan.CRAFT_TIME) * 27)); } }
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); }/* w ww. jav 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.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.GuiAdvancedInterface.java
License:Minecraft Mod Public
protected void drawBackgroundSlots() { int cornerX = (width - xSize) / 2; int cornerY = (height - ySize) / 2; RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix();//from w w w . ja v a 2 s . c om GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); int i1 = 240; int k1 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); for (AdvancedSlot slot : slots) { if (slot != null) { slot.drawSprite(cornerX, cornerY); } } GL11.glPopMatrix(); }
From source file:buildcraft.core.gui.GuiBuildCraft.java
License:Minecraft Mod Public
/** * Draws the screen and all the components in it. *///from ww w . j a va 2 s . c o 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 ww . j a v a2s . co m*/ } 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); }/*from w w w . j a v a 2 s .c om*/ 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;// ww w . j a v a 2 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); }//from w w w. j av a 2 s . com }
From source file:buildcraft.core.lib.gui.GuiAdvancedInterface.java
License:Minecraft Mod Public
protected void drawBackgroundSlots(int mouseX, int mouseY) { RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix();//from ww w .j av a2 s .c o m GL11.glPushAttrib(GL11.GL_TRANSFORM_BIT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); int i1 = 240; int k1 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (slots != null) { for (AdvancedSlot slot : slots) { if (slot != null) { slot.drawSprite(guiLeft, guiTop); drawSlotHighlight(slot, mouseX, mouseY); } } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
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);/*from w w w .ja v a 2s .com*/ GuiAdvancedInterface.getItemRenderer().renderItemOverlayIntoGUI(getFontRenderer(), mc.renderEngine, item, x, y); GuiAdvancedInterface.getItemRenderer().zLevel = prevZ; GL11.glDisable(GL11.GL_LIGHTING); } }