List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler.java
License:LGPL
public void drawInWorldTransmutationOverlay(DrawBlockHighlightEvent event) { double x = event.target.blockX + 0.5F; double y = event.target.blockY + 0.5F; double z = event.target.blockZ + 0.5F; double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks; double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks; double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks; int texture = event.context.renderEngine.getTexture(Textures.EFFECT_WORLD_TRANSMUTATION); float xScale = 1; float yScale = 1; float zScale = 1; float xShift = 0.1F; float yShift = 0.1F; float zShift = 0.1F; int chargeLevel; int itemChargeLevel = 0; if (event.currentItem.getItem() instanceof IChargeable) { itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem); }/* ww w .j av a 2s. co m*/ chargeLevel = 1 + itemChargeLevel * 2; ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit); switch (sideHit) { case UP: { xScale = chargeLevel + 0.1F; zScale = chargeLevel + 0.1F; xShift = 0; zShift = 0; break; } case DOWN: { xScale = chargeLevel + 0.1F; zScale = chargeLevel + 0.1F; xShift = 0; yShift = -yShift; zShift = 0; break; } case NORTH: { xScale = chargeLevel + 0.1F; yScale = chargeLevel + 0.1F; xShift = 0; yShift = 0; zShift = -zShift; break; } case SOUTH: { xScale = chargeLevel + 0.1F; yScale = chargeLevel + 0.1F; xShift = 0; yShift = 0; break; } case EAST: { yScale = chargeLevel + 0.1F; zScale = chargeLevel + 0.1F; yShift = 0; zShift = 0; break; } case WEST: { yScale = chargeLevel + 0.1F; zScale = chargeLevel + 0.1F; xShift = -xShift; yShift = 0; zShift = 0; break; } default: break; } GL11.glDepthMask(false); GL11.glDisable(GL11.GL_CULL_FACE); for (int i = 0; i < 6; i++) { ForgeDirection forgeDir = ForgeDirection.getOrientation(i); int zCorrection = i == 2 ? -1 : 1; GL11.glPushMatrix(); GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift); GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale); GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ); GL11.glTranslated(0, 0, 0.5f * zCorrection); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); renderPulsingQuad(texture, 0.75F); GL11.glPopMatrix(); } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(true); }
From source file:com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler.java
License:LGPL
public static void renderPulsingQuad(int texture, float maxTransparency) { float pulseTransparency = getPulseValue() * maxTransparency / 3000f; GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_BLEND);/* w ww .j a v a2 s . c om*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, pulseTransparency); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(1, 1, 1, pulseTransparency); tessellator.addVertexWithUV(-0.5D, 0.5D, 0F, 0, 1); tessellator.addVertexWithUV(0.5D, 0.5D, 0F, 1, 1); tessellator.addVertexWithUV(0.5D, -0.5D, 0F, 1, 0); tessellator.addVertexWithUV(-0.5D, -0.5D, 0F, 0, 0); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL12.GL_RESCALE_NORMAL); }
From source file:com.pahimar.ee3.core.handlers.TransmutationTargetOverlayHandler.java
License:LGPL
private static void renderStoneHUD(Minecraft minecraft, EntityPlayer player, ItemStack stack, float partialTicks) { float overlayScale = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE; float blockScale = overlayScale / 2; float overlayOpacity = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY; GL11.glPushMatrix();/*from w w w. j av a 2 s .co m*/ ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight); GL11.glClear(256); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glPushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); int hudOverlayX = 0; int hudOverlayY = 0; int hudBlockX = 0; int hudBlockY = 0; switch (ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION) { case 0: { hudOverlayX = 0; hudBlockX = (int) (16 * overlayScale / 2 - 8); hudOverlayY = 0; hudBlockY = (int) (16 * overlayScale / 2 - 8); break; } case 1: { hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale); hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8); hudOverlayY = 0; hudBlockY = (int) (16 * overlayScale / 2 - 8); break; } case 2: { hudOverlayX = 0; hudBlockX = (int) (16 * overlayScale / 2 - 8); hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale); hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8); break; } case 3: { hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale); hudBlockX = (int) (sr.getScaledWidth() - 16 * overlayScale / 2 - 8); hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale); hudBlockY = (int) (sr.getScaledHeight() - 16 * overlayScale / 2 - 8); break; } default: { break; } } RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, stack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale); if (TransmutationHelper.targetBlockStack != null && TransmutationHelper.targetBlockStack.getItem() instanceof ItemBlock) { RenderUtils.renderRotatingBlockIntoGUI(minecraft.fontRenderer, minecraft.renderEngine, TransmutationHelper.targetBlockStack, hudBlockX, hudBlockY, -90, blockScale); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:com.parachute.client.RenderParachute.java
License:Open Source License
public void renderLargeParachuteCords(EntityPlayer rider, float center) { float zOffset = 3.0F; float x = 0.0F; float y = 2.5F; if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view y = 1.5F;/* ww w .ja v a 2 s . c o m*/ } float zl = -zOffset; float zr = zOffset; float b = rider.getBrightness(center); GlStateManager.pushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.scale(0.0625F, -1.0F, 0.0625F); GL11.glBegin(GL11.GL_LINES); // left end GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue GL11.glVertex3f(-8F, 0.37F, -31.5F); // top - front GL11.glVertex3f(x, y, zl); // bottom GL11.glVertex3f(8F, 0.37F, -31.5F); // ...back GL11.glVertex3f(x, y, zl); // left middle GL11.glVertex3f(-8F, 0.12F, -16F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0.12F, -16F); GL11.glVertex3f(x, y, zl); // right end GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red GL11.glVertex3f(-8F, 0.37F, 31.5F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.37F, 31.5F); GL11.glVertex3f(x, y, zr); // right middle GL11.glVertex3f(-8F, 0.12F, 16F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.12F, 16F); GL11.glVertex3f(x, y, zr); // center GlStateManager.color(b * 0.5F, b * 0.65F, b * 0.5F); // slightly green GL11.glVertex3f(-8F, 0F, 0F); GL11.glVertex3f(x, y, zl); // first center cord goes to the left GL11.glVertex3f(8F, 0F, 0F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(-8F, 0F, 0F); // second center cord goes to the right GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0F, 0F); GL11.glVertex3f(x, y, zr); GL11.glEnd(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GlStateManager.popMatrix(); }
From source file:com.parachute.client.RenderParachute.java
License:Open Source License
public void renderSmallParachuteCords(EntityPlayer rider, float center) { float zOffset = 3.0F; float x = 0.0F; float y = 1.5F; if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { // first person view y = 1.25F;//from www .j a v a 2s. co m } float zl = -zOffset; float zr = zOffset; float b = rider.getBrightness(center); GlStateManager.pushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GlStateManager.scale(0.0625F, -1.0F, 0.0625F); GL11.glBegin(GL11.GL_LINES); // left side GlStateManager.color(b * 0.5F, b * 0.5F, b * 0.65F); // slightly blue GL11.glVertex3f(-8F, 0.25F, -23.5F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0.25F, -23.5F); GL11.glVertex3f(x, y, zl); // front GL11.glVertex3f(-8F, 0F, -8F); GL11.glVertex3f(x, y, zl); GL11.glVertex3f(8F, 0F, -8F); GL11.glVertex3f(x, y, zl); // right side GlStateManager.color(b * 0.65F, b * 0.5F, b * 0.5F); // slightly red GL11.glVertex3f(-8F, 0.25F, 23.5F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0.25F, 23.5F); GL11.glVertex3f(x, y, zr); // back GL11.glVertex3f(-8F, 0F, 8F); GL11.glVertex3f(x, y, zr); GL11.glVertex3f(8F, 0F, 8F); GL11.glVertex3f(x, y, zr); GL11.glEnd(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GlStateManager.popMatrix(); }
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;// w w w. j a va 2s. 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 .j a v a2 s . co 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 . jav a 2 s. c o m*/ 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
@Override @SideOnly(Side.CLIENT)// ww w .j a v a 2 s . c o m public void renderScreen(IGuiBookEntry gui, int mx, int my) { relativeMouseX = mx; relativeMouseY = my; renderRecipe(gui, mx, my); 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()); if (tooltipStack != null) { List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); List<String> parsedTooltip = new ArrayList(); boolean first = true; for (String s : tooltipData) { String s_ = s; if (!first) s_ = EnumChatFormatting.GRAY + s; parsedTooltip.add(s_); first = false; } com.professorvennie.machinerycraft.core.helpers.RenderHelper.renderTooltip(mx, my, parsedTooltip); int tooltipY = 8 + tooltipData.size() * 11; if (tooltipEntry) { com.professorvennie.machinerycraft.core.helpers.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList( EnumChatFormatting.GRAY + StatCollector.translateToLocal("mc.book.clickToRecipe"))); tooltipY += 18; } if (tooltipContainerStack != null) com.professorvennie.machinerycraft.core.helpers.RenderHelper.renderTooltipOrange(mx, my + tooltipY, Arrays.asList( EnumChatFormatting.AQUA + StatCollector.translateToLocal("botaniamisc.craftingContainer"), tooltipContainerStack.getDisplayName())); } tooltipStack = tooltipContainerStack = null; tooltipEntry = false; GL11.glDisable(GL11.GL_BLEND); mouseDownLastTick = Mouse.isButtonDown(0); }
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 w w. j av a2s. 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); }