List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:com.professorvennie.machinerycraft.client.gui.GuiBase.java
License:Creative Commons License
@SuppressWarnings("rawtypes") protected void drawTooltipHoveringTextf(List list, int x, int y, FontRenderer font) { if (list == null || list.isEmpty()) return;/*from w w w.j a v a 2 s .co m*/ GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; Iterator iterator = list.iterator(); while (iterator.hasNext()) { String s = (String) iterator.next(); int l = font.getStringWidth(s); if (l > k) { k = l; } } int i1 = x + 12; int j1 = y - 12; int k1 = 8; if (list.size() > 1) k1 += 2 + (list.size() - 1) * 10; if (i1 + k > this.width) i1 -= 28 + k; if (j1 + k1 + 6 > this.height) j1 = this.height - k1 - 6; this.zLevel = 300.0F; itemRender.zLevel = 300.0F; int l1 = -267386864; this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1); this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1); this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1); int i2 = 1347420415; int j2 = (i2 & 16711422) >> 1 | i2 & -16777216; this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2); this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2); this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2); for (int k2 = 0; k2 < list.size(); ++k2) { String s1 = (String) list.get(k2); font.drawStringWithShadow(s1, i1, j1, -1); if (k2 == 0) j1 += 2; j1 += 10; } this.zLevel = 0.0F; itemRender.zLevel = 0.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL12.GL_RESCALE_NORMAL); }
From source file:com.professorvennie.machinerycraft.client.gui.pages.PageCraftingRecipe.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)//from w ww . ja v a 2 s . c o m public void renderRecipe(IGuiBookEntry gui, int mx, int my) { oreDictRecipe = shapelessRecipe = false; IRecipe recipe = recipes.get(recipeAt); renderCraftingRecipe(gui, recipe); TextureManager render = Minecraft.getMinecraft().renderEngine; render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); int iconX = gui.getLeft() + 115; int iconY = gui.getTop() + 12; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (shapelessRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16); if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("mc.book.shapeless"))); iconY += 20; } render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); if (oreDictRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) RenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("mc.book.oredict"))); } GL11.glDisable(GL11.GL_BLEND); }
From source file:com.professorvennie.machinerycraft.client.gui.pages.PageImage.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)// ww w.ja va2 s . c om public void renderScreen(IGuiBookEntry gui, int mx, int my) { TextureManager render = Minecraft.getMinecraft().renderEngine; render.bindTexture(resource); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); GL11.glDisable(GL11.GL_BLEND); int width = gui.getWidth() - 30; int height = gui.getHeight(); int x = gui.getLeft() + 16; int y = gui.getTop() + height - 40; PageText.renderText(x, y, width, height, getUnlocalizedName()); }
From source file:com.professorvennie.machinerycraft.client.gui.pages.PageRecipe.java
License:Creative Commons License
@SideOnly(Side.CLIENT) public void renderItem(IGuiBookEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) { RenderItem render = new RenderItem(); boolean mouseDown = Mouse.isButtonDown(0); GL11.glPushMatrix();//from w ww .j a v a 2 s. c o m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_DEPTH_TEST); render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); if (relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) { tooltipStack = stack; EntryData data = BookRecipeMappings.getDataForStack(tooltipStack); if (data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) { tooltipEntry = true; if (!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) { GuiBookEntry newGui = new GuiBookEntry(data.entry, (GuiScreen) gui); newGui.page = data.page; Minecraft.getMinecraft().displayGuiScreen(newGui); } } if (accountForContainer) { ItemStack containerStack = stack.getItem().getContainerItem(stack); if (containerStack != null && containerStack.getItem() != null) tooltipContainerStack = containerStack; } } GL11.glDisable(GL11.GL_LIGHTING); }
From source file:com.professorvennie.machinerycraft.client.renderer.item.ItemRenderCable.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glDisable(GL11.GL_LIGHTING);//from w w w .ja v a 2 s . c om Minecraft.getMinecraft().renderEngine.bindTexture(texture); new TileEntityRendererCable().drawStriaght(ForgeDirection.NORTH); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:com.professorvennie.machinerycraft.client.renderer.tileentity.TileEntityRendererCable.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float var8) { GL11.glTranslated(x, y, z);/*from w w w . j av a2s .com*/ GL11.glDisable(GL11.GL_LIGHTING); this.bindTexture(texture); TileEntityCable cable = (TileEntityCable) entity; if (!cable.onlyOneOppsoite(cable.connections)) { RenderCenter(); for (int i = 0; i < cable.connections.length; i++) { if (cable.connections[i] != null) { drawConnector(cable.connections[i]); } } } else { for (int i = 0; i < cable.connections.length; i++) { if (cable.connections[i] != null) { drawStriaght(cable.connections[i]); break; } } } GL11.glEnable(GL11.GL_LIGHTING); GL11.glTranslated(-x, -y, -z); }
From source file:com.professorvennie.machinerycraft.client.renderer.tileentity.TileEntityRendererPlasticChest.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) { if (tileEntity instanceof TileEntityPlasticChest) { TileEntityPlasticChest tileEntityPlasticChest = (TileEntityPlasticChest) tileEntity; ForgeDirection direction = null; if (tileEntityPlasticChest.getWorldObj() != null) { direction = tileEntityPlasticChest.getOrientation(); //System.out.println(tileEntityPlasticChest.getOrientation()); }/*ww w.j av a 2s. co m*/ this.bindTexture(texture); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short angle = 0; if (direction != null) { if (direction == ForgeDirection.NORTH) { angle = 180; } else if (direction == ForgeDirection.SOUTH) { angle = 0; } else if (direction == ForgeDirection.WEST) { angle = 90; } else if (direction == ForgeDirection.EAST) { angle = -90; } } GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float adjustedLidAngle = tileEntityPlasticChest.prevLidAngle + (tileEntityPlasticChest.lidAngle - tileEntityPlasticChest.prevLidAngle) * tick; adjustedLidAngle = 1.0F - adjustedLidAngle; adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle; modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F); modelChest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } }
From source file:com.professorvennie.machinerycraft.core.handlers.HudHandler.java
License:Creative Commons License
private void drawBookGUI(BookEntry entry, ScaledResolution res) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Minecraft mc = Minecraft.getMinecraft(); int x = res.getScaledWidth() / 2 + 8; int y = res.getScaledHeight() / 2 - 4; int color = 0xFF5A28; String info = StatCollector.translateToLocal("mc.book.shiftToRead"); int itemX = x - (mc.fontRenderer.getStringWidth(new ItemStack(ModItems.book).getDisplayName()) / 2); mc.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal(entry.getUnlocalizedName()), itemX, y + 6, color);/* ww w. jav a 2s . c o m*/ mc.fontRenderer.drawStringWithShadow(info, x - (mc.fontRenderer.getStringWidth(info) / 2), y + 18, color); itemRender.renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.book), itemX - 20, y + 2); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1F, 1F, 1F, 1F); }
From source file:com.professorvennie.machinerycraft.core.helpers.RenderHelper.java
License:Creative Commons License
public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) { boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); if (lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); if (!tooltipData.isEmpty()) { int var5 = 0; int var6; int var7; FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; for (var6 = 0; var6 < tooltipData.size(); ++var6) { var7 = fontRenderer.getStringWidth(tooltipData.get(var6)); if (var7 > var5) var5 = var7; }/*from w w w. j a va 2 s . com*/ var6 = x + 12; var7 = y - 12; int var9 = 8; if (tooltipData.size() > 1) var9 += 2 + (tooltipData.size() - 1) * 10; float z = 300F; drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2); drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 - 4, var7 - 3, z, var6 - 3, var7 + var9 + 3, color2, color2); drawGradientRect(var6 + var5 + 3, var7 - 3, z, var6 + var5 + 4, var7 + var9 + 3, color2, color2); int var12 = (color & 0xFFFFFF) >> 1 | color & -16777216; drawGradientRect(var6 - 3, var7 - 3 + 1, z, var6 - 3 + 1, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, z, var6 + var5 + 3, var7 + var9 + 3 - 1, color, var12); drawGradientRect(var6 - 3, var7 - 3, z, var6 + var5 + 3, var7 - 3 + 1, color, color); drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12); GL11.glDisable(GL11.GL_DEPTH_TEST); for (int var13 = 0; var13 < tooltipData.size(); ++var13) { String var14 = tooltipData.get(var13); fontRenderer.drawStringWithShadow(var14, var6, var7, -1); if (var13 == 0) var7 += 2; var7 += 10; } GL11.glEnable(GL11.GL_DEPTH_TEST); } if (!lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GL11.glColor4f(1F, 1F, 1F, 1F); }