List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:hellfirepvp.astralsorcery.client.gui.container.GuiAltarTrait.java
License:Open Source License
@Override public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { AbstractAltarRecipe rec = findCraftableRecipe(); if (rec != null) { ItemStack out = rec.getOutputForRender(); zLevel = 10F;/*from ww w . j a v a 2 s . c om*/ itemRender.zLevel = 10F; RenderHelper.enableGUIStandardItemLighting(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); GL11.glTranslated(190, 35, 0); GL11.glScaled(2.5, 2.5, 2.5); itemRender.renderItemAndEffectIntoGUI(mc.player, out, 0, 0); itemRender.renderItemOverlayIntoGUI(fontRenderer, out, 0, 0, null); GL11.glPopMatrix(); GL11.glPopAttrib(); zLevel = 0F; itemRender.zLevel = 0F; TextureHelper.refreshTextureBindState(); } float pTicks = Minecraft.getMinecraft().getRenderPartialTicks(); RenderAstralSkybox.TEX_STAR_1.bind(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); Blending.DEFAULT.apply(); rand.setSeed(0x889582997FF29A92L); for (int i = 0; i < 16; i++) { int x = rand.nextInt(54); int y = rand.nextInt(54); GL11.glPushMatrix(); float brightness = 0.3F + (RenderConstellation.stdFlicker(Minecraft.getMinecraft().world.getWorldTime(), pTicks, 10 + rand.nextInt(20))) * 0.6F; GL11.glColor4f(brightness, brightness, brightness, brightness); drawRect(15 + x, 39 + y, 5, 5); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); } GL11.glPopAttrib(); TextureHelper.refreshTextureBindState(); IConstellation c = containerAltarBase.tileAltar.getFocusedConstellation(); if (c != null && containerAltarBase.tileAltar.getMultiblockState() && ResearchManager.clientProgress.hasConstellationDiscovered(c.getUnlocalizedName())) { rand.setSeed(0x61FF25A5B7C24109L); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); Blending.DEFAULT.apply(); RenderConstellation.renderConstellationIntoGUI(c, 16, 41, zLevel, 58, 58, 2, new RenderConstellation.BrightnessFunction() { @Override public float getBrightness() { return RenderConstellation.conCFlicker( Minecraft.getMinecraft().world.getTotalWorldTime(), pTicks, 5 + rand.nextInt(5)); } }, true, false); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); GL11.glPopAttrib(); } TextureHelper.setActiveTextureToAtlasSprite(); TextureHelper.refreshTextureBindState(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiConstellationPaper.java
License:Open Source License
private void drawHeader() { String locName = I18n.format(constellation.getUnlocalizedName()).toUpperCase(); TextureHelper.refreshTextureBindState(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; double length = fr.getStringWidth(locName) * 1.8; double offsetLeft = width / 2 - length / 2; int offsetTop = guiTop + 31; //new Color(0.3F, 0.3F, 0.3F, 0.8F); //GL11.glColor4f(0.3F, 0.3F, 0.3F, 0.8F); GL11.glPushMatrix();// ww w. j a v a 2 s . c om GL11.glTranslated(offsetLeft + 15, offsetTop, 0); GL11.glScaled(1.8, 1.8, 1.8); fr.drawString(locName, 0, 0, 0xAA4D4D4D, false); GL11.glPopMatrix(); GlStateManager.color(1, 1, 1, 1); GL11.glColor4f(1, 1, 1, 1); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiConstellationPaper.java
License:Open Source License
private void drawPhaseInformation() { GL11.glEnable(GL11.GL_BLEND);//from w w w . j a v a2 s . c o m Blending.DEFAULT.apply(); GL11.glColor4f(1, 1, 1, 1); if (constellation instanceof IConstellationSpecialShowup) { double scale = 1.8; TextureHelper.refreshTextureBindState(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; double length = fr.getStringWidth("? ? ?") * scale; double offsetLeft = width / 2 - length / 2; int offsetTop = guiTop + 207; GL11.glPushMatrix(); GL11.glTranslated(offsetLeft + 10, offsetTop, 0); GL11.glScaled(scale, scale, scale); fr.drawString("? ? ?", 0, 0, 0xAA4D4D4D, false); GL11.glPopMatrix(); GlStateManager.color(1, 1, 1, 1); GL11.glColor4f(1, 1, 1, 1); TextureHelper.refreshTextureBindState(); } else { int size = 15; int offsetX = (width / 2 + 5) - (phases.size() * (size + 2)) / 2; int offsetY = guiTop + 206; for (int i = 0; i < phases.size(); i++) { MoonPhase ph = phases.get(i); MoonPhaseRenderHelper.getMoonPhaseTexture(ph).bind(); drawRect(offsetX + (i * (size + 2)), offsetY, size, size); } } }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationCluster.java
License:Open Source License
private void drawNavArrows(float partialTicks) { Point mouse = getCurrentMousePoint(); int cIndex = pageId * 6; rectBack = null;/*from www . ja v a2s . c o m*/ rectNext = null; rectPrev = null; GL11.glColor4f(1F, 1F, 1F, 1F); if (cIndex > 0) { int width = 30; int height = 15; rectPrev = new Rectangle(guiLeft + 15, guiTop + 127, width, height); GL11.glPushMatrix(); GL11.glTranslated(rectPrev.getX() + (width / 2), rectPrev.getY() + (height / 2), 0); float uFrom = 0F, vFrom = 0.5F; if (rectPrev.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } int nextIndex = cIndex + 6; if (constellations.size() >= (nextIndex + 1)) { int width = 30; int height = 15; rectNext = new Rectangle(guiLeft + 367, guiTop + 125, width, height); GL11.glPushMatrix(); GL11.glTranslated(rectNext.getX() + (width / 2), rectNext.getY() + (height / 2), 0); float uFrom = 0F, vFrom = 0F; if (rectNext.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } if (bookmarkIndex != 1) { int width = 30; int height = 15; rectBack = new Rectangle(guiLeft + 197, guiTop + 230, width, height); GL11.glPushMatrix(); GL11.glTranslated(rectBack.getX() + (width / 2), rectBack.getY() + (height / 2), 0); float uFrom = 0F, vFrom = 0.5F; if (rectBack.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationCluster.java
License:Open Source License
protected static Rectangle drawConstellationRect(IConstellation display, double offsetX, double offsetY, float zLevel, Point mouse, @Nullable String specTitle) { Rectangle rect = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), width, height); GL11.glPushMatrix();/*from w ww . j a v a 2s. co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glTranslated(offsetX + (width / 2), offsetY + (width / 2), zLevel); if (rect.contains(mouse)) { GL11.glScaled(1.1, 1.1, 1.1); } GL11.glTranslated(-(width / 2), -(width / 2), zLevel); Color c = new Color(0x00DDDDDD); float r = 0xDD / 255F; float g = 0xDD / 255F; float b = 0xDD / 255F; GL11.glColor4f(r, g, b, 1F); RenderConstellation.renderConstellationIntoGUI(c, display, 0, 0, 0, 80, 80, 2.5F, new RenderConstellation.BrightnessFunction() { @Override public float getBrightness() { return 0.15F; } }, true, false); GL11.glColor4f(r, g, b, 1F); TextureHelper.refreshTextureBindState(); String trName = specTitle == null ? I18n.format(display.getUnlocalizedName()).toUpperCase() : I18n.format(specTitle).toUpperCase(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; float fullLength = (width / 2) - (((float) fr.getStringWidth(trName)) / 2F); fr.drawString(trName, fullLength, 75F, 0xBBDDDDDD, true); GL11.glColor4f(1F, 1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glPopMatrix(); return rect; }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationDetails.java
License:Open Source License
private void drawExtendedInformation() { float br = 0.8666F; GL11.glColor4f(br, br, br, 0.8F);/*from w w w. j a va2 s . co m*/ String info = I18n.format(constellation.getUnlocalizedInfo()).toUpperCase(); info = detailed ? info : "???"; TextureHelper.refreshTextureBindState(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; double width = fr.getStringWidth(info); double chX = 305 - (width * 1.8 / 2); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslated(guiLeft + chX, guiTop + 26, 0); GL11.glScaled(1.8, 1.8, 1.8); fr.drawString(info, 0, 0, 0xCCDDDDDD, true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glColor4f(br, br, br, 0.8F); TextureHelper.refreshTextureBindState(); if (detailed && !locText.isEmpty()) { int offsetX = 220, offsetY = 70; for (String s : locText) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslated(guiLeft + offsetX, guiTop + offsetY, 0); fr.drawString(s, 0, 0, 0xCCDDDDDD, true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glColor4f(br, br, br, 0.8F); TextureHelper.refreshTextureBindState(); offsetY += 13; } } /*texArrow.bind(); fontRenderer.font_size_multiplicator = 0.06F; String pref = I18n.translateToLocal("constraint.description"); fontRenderer.drawString(pref, guiLeft + 228, guiTop + 60, zLevel, null, 0.7F, 0); texArrow.bind(); fontRenderer.font_size_multiplicator = 0.05F; SizeConstraint sc = constellation.getSizeConstraint(); String trSize = I18n.translateToLocal(sc.getUnlocalizedName()); fontRenderer.drawString("- " + trSize, guiLeft + 228, guiTop + 85, zLevel, null, 0.7F, 0); List<RitualConstraint> constrList = constellation.getConstraints(); for (int i = 0; i < constrList.size(); i++) { RitualConstraint cstr = constrList.get(i); String str = I18n.translateToLocal(cstr.getUnlocalizedName()); texArrow.bind(); fontRenderer.font_size_multiplicator = 0.05F; fontRenderer.drawString("- " + str, guiLeft + 228, guiTop + 107 + (i * 22), zLevel, null, 0.7F, 0); }*/ }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationDetails.java
License:Open Source License
private void drawPhaseInformation() { if (constellation instanceof IConstellationSpecialShowup) { GL11.glDisable(GL11.GL_DEPTH_TEST); double scale = 1.8; TextureHelper.refreshTextureBindState(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; double length = fr.getStringWidth("? ? ?") * scale; double offsetLeft = guiLeft + 296 - length / 2; int offsetTop = guiTop + 199; GL11.glPushMatrix();//from w w w. ja v a 2 s .com GL11.glTranslated(offsetLeft + 10, offsetTop, 0); GL11.glScaled(scale, scale, scale); fr.drawStringWithShadow("? ? ?", 0, 0, 0xCCDDDDDD); GL11.glPopMatrix(); GlStateManager.color(1, 1, 1, 1); GL11.glColor4f(1, 1, 1, 1); TextureHelper.refreshTextureBindState(); GL11.glEnable(GL11.GL_DEPTH_TEST); } else { GL11.glEnable(GL11.GL_BLEND); Blending.DEFAULT.apply(); GL11.glColor4f(1F, 1F, 1F, 1F); int size = 19; int offsetX = 95 + (width / 2) - (phases.size() * (size + 2)) / 2; int offsetY = 199 + guiTop; for (int i = 0; i < phases.size(); i++) { MoonPhase ph = phases.get(i); MoonPhaseRenderHelper.getMoonPhaseTexture(ph).bind(); drawRect(offsetX + (i * (size + 2)), offsetY, size, size); } } }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationDetails.java
License:Open Source License
private void drawConstellation() { float br = 0.866F; GL11.glColor4f(br, br, br, 0.8F);//from w w w . j av a2 s. c o m String name = I18n.format(constellation.getUnlocalizedName()).toUpperCase(); TextureHelper.refreshTextureBindState(); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; double width = fr.getStringWidth(name); double offsetX = 110 - (width * 1.8 / 2); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslated(guiLeft + offsetX, guiTop + 26, 0); GL11.glScaled(1.8, 1.8, 1.8); fr.drawString(name, 0, 0, 0xCCDDDDDD, true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glColor4f(br, br, br, 0.8F); TextureHelper.refreshTextureBindState(); String dstInfo = "astralsorcery.journal.constellation.dst."; if (constellation instanceof IMajorConstellation) { dstInfo += "major"; } else if (constellation instanceof IWeakConstellation) { dstInfo += "weak"; } else { dstInfo += "minor"; } if (!detailed) { dstInfo = "???"; } dstInfo = I18n.format(dstInfo); width = fr.getStringWidth(dstInfo); offsetX = 110 - (width * 1.25 / 2); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslated(guiLeft + offsetX, guiTop + 46, 0); GL11.glScaled(1.25, 1.25, 1.25); fr.drawString(dstInfo, 0, 0, 0xCCDDDDDD, true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glColor4f(br, br, br, 0.8F); TextureHelper.refreshTextureBindState(); GL11.glEnable(GL11.GL_BLEND); Blending.DEFAULT.apply(); RenderConstellation.renderConstellationIntoGUI(new Color(0x00DDDDDD), constellation, guiLeft + 25, guiTop + 60, zLevel, 170, 170, 2F, new RenderConstellation.BrightnessFunction() { @Override public float getBrightness() { return 0.5F; } }, true, false); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationDetails.java
License:Open Source License
private void drawBackArrow(float partialTicks) { Point mouse = getCurrentMousePoint(); int width = 30; int height = 15; rectBack = new Rectangle(guiLeft + 197, guiTop + 230, width, height); GL11.glPushMatrix();/*from www. ja va2s. c o m*/ GL11.glTranslated(rectBack.getX() + (width / 2), rectBack.getY() + (height / 2), 0); float uFrom = 0F, vFrom = 0.5F; if (rectBack.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glColor4f(1F, 1F, 1F, 0.8F); GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiTelescope.java
License:Open Source License
private void drawRotationArrows(float partialTicks) { GL11.glDisable(GL11.GL_DEPTH_TEST);/*from w w w .jav a 2 s . c o m*/ Point mouse = getCurrentMousePoint(); rectArrowCW = null; rectArrowCCW = null; int width = 30; int height = 15; rectArrowCCW = new Rectangle(guiLeft - 40, guiTop + (guiHeight / 2), width, height); GL11.glPushMatrix(); GL11.glTranslated(rectArrowCCW.getX() + (width / 2), rectArrowCCW.getY() + (height / 2), 0); float uFrom = 0F, vFrom = 0.5F; if (rectArrowCCW.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glColor4f(1F, 1F, 1F, 0.8F); GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); rectArrowCW = new Rectangle(guiLeft + guiWidth + 10, guiTop + (guiHeight / 2), width, height); GL11.glPushMatrix(); GL11.glTranslated(rectArrowCW.getX() + (width / 2), rectArrowCW.getY() + (height / 2), 0); uFrom = 0F; vFrom = 0F; if (rectArrowCW.contains(mouse)) { uFrom = 0.5F; GL11.glScaled(1.1, 1.1, 1.1); } else { double t = ClientScheduler.getClientTick() + partialTicks; float sin = ((float) Math.sin(t / 4F)) / 32F + 1F; GL11.glScaled(sin, sin, sin); } GL11.glColor4f(1F, 1F, 1F, 0.8F); GL11.glTranslated(-(width / 2), -(height / 2), 0); texArrow.bind(); drawTexturedRectAtCurrentPos(width, height, uFrom, vFrom, 0.5F, 0.5F); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); }