List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
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 www.j av a 2s. com*/ 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.container.GuiAltarTrait.java
License:Open Source License
@Override public void renderGuiBackground(float partialTicks, int mouseX, int mouseY) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from ww w . j a va 2s. co m GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float percFilled; if (containerAltarBase.tileAltar.getMultiblockState()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); percFilled = containerAltarBase.tileAltar.getAmbientStarlightPercent(); } else { GL11.glColor4f(1.0F, 0F, 0F, 1.0F); percFilled = 1.0F; } texBlack.bind(); drawRect(guiLeft + 11, guiTop + 104, 232, 10); if (percFilled > 0) { SpriteSheetResource spriteStarlight = SpriteLibrary.spriteStarlight; spriteStarlight.getResource().bind(); int t = containerAltarBase.tileAltar.getTicksExisted(); Tuple<Double, Double> uvOffset = spriteStarlight.getUVOffset(t); drawRect(guiLeft + 11, guiTop + 104, (int) (232 * percFilled), 10, uvOffset.key, uvOffset.value, spriteStarlight.getULength() * percFilled, spriteStarlight.getVLength()); AbstractAltarRecipe aar = findCraftableRecipe(true); if (aar != null) { int req = aar.getPassiveStarlightRequired(); int has = containerAltarBase.tileAltar.getStarlightStored(); if (has < req) { int max = containerAltarBase.tileAltar.getMaxStarlightStorage(); float percReq = (float) (req - has) / (float) max; int from = (int) (232 * percFilled); int to = (int) (232 * percReq); GL11.glColor4f(0.2F, 0.5F, 1.0F, 0.4F); drawRect(guiLeft + 11 + from, guiTop + 104, to, 10, uvOffset.key + spriteStarlight.getULength() * percFilled, uvOffset.value, spriteStarlight.getULength() * percReq, spriteStarlight.getVLength()); } } } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); texAltarTrait.bind(); drawRect(guiLeft, guiTop, xSize, ySize); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiConstellationPaper.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { //ofr.font_size_multiplicator = 0.08F; GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from ww w. j a v a 2 s. c o m drawScroll(); drawHeader(); drawConstellation(partialTicks); drawPhaseInformation(); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiHandTelescope.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from w w w . ja v a 2s.c o m*/ GL11.glEnable(GL11.GL_BLEND); drawWHRect(textureGrid); TextureHelper.refreshTextureBindState(); handleMouseMovement(partialTicks); World w = Minecraft.getMinecraft().world; float pitch = Minecraft.getMinecraft().player.rotationPitch; float transparency = 0F; if (pitch < -60F) { transparency = 1F; } else if (pitch < -10F) { transparency = (Math.abs(pitch) - 10F) / 50F; if (ConstellationSkyHandler.getInstance().isNight(w)) { transparency *= transparency; } } boolean canSeeSky = canTelescopeSeeSky(w); if (usedStars.isEmpty()) { Optional<Long> currSeed = ConstellationSkyHandler.getInstance() .getSeedIfPresent(Minecraft.getMinecraft().world); if (currSeed.isPresent()) { setupInitialStars(currSeed.get()); zLevel -= 5; drawCellWithEffects(partialTicks, canSeeSky, transparency); zLevel += 5; } } else { zLevel -= 5; drawCellWithEffects(partialTicks, canSeeSky, transparency); zLevel += 5; } TextureHelper.refreshTextureBindState(); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiHandTelescope.java
License:Open Source License
private Optional<Map<StarLocation, Rectangle>> drawCellEffect(int offsetX, int offsetY, int width, int height, float partialTicks, float transparency) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND);//from ww w . j a v a 2 s . com Blending.DEFAULT.apply(); GL11.glDisable(GL11.GL_ALPHA_TEST); WorldSkyHandler handle = ConstellationSkyHandler.getInstance() .getWorldHandler(Minecraft.getMinecraft().world); int lastTracked = handle == null ? 5 : handle.lastRecordedDay; Random r = new Random(); RenderAstralSkybox.TEX_STAR_1.bind(); for (StarPosition stars : usedStars) { r.setSeed(stars.seed); GL11.glPushMatrix(); float brightness = 0.3F + (RenderConstellation.stdFlicker(ClientScheduler.getClientTick(), partialTicks, 10 + r.nextInt(20))) * 0.6F; brightness *= Minecraft.getMinecraft().world.getStarBrightness(partialTicks) * 2 * transparency; brightness *= (1F - Minecraft.getMinecraft().world.getRainStrength(partialTicks)); GL11.glColor4f(brightness, brightness, brightness, brightness); drawRect(MathHelper.floor(offsetX + stars.x), MathHelper.floor(offsetY + stars.y), 5, 5); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); } r.setSeed(lastTracked * 31); Map<StarLocation, Rectangle> rectangles = null; if (topFound != null) { zLevel += 1; float playerYaw = Minecraft.getMinecraft().player.rotationYaw % 360F; if (playerYaw < 0) { playerYaw += 360F; } if (playerYaw >= 180F) { playerYaw -= 360F; } float playerPitch = Minecraft.getMinecraft().player.rotationPitch; float diffYaw = playerYaw - selectedYaw; float diffPitch = playerPitch - selectedPitch; float sFactor = 35F; if ((Math.abs(diffYaw) <= sFactor || Math.abs(playerYaw + 360F) <= sFactor) && Math.abs(diffPitch) <= sFactor) { ScaledResolution res = new ScaledResolution(mc); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor((guiLeft + 5) * res.getScaleFactor(), (guiTop + 5) * res.getScaleFactor(), (guiWidth - 10) * res.getScaleFactor(), (guiHeight - 10) * res.getScaleFactor()); int wPart = ((int) (((float) width) * 0.1F)); int hPart = ((int) (((float) height) * 0.1F)); rectangles = RenderConstellation.renderConstellationIntoGUI(topFound, offsetX + wPart + MathHelper.floor((diffYaw / sFactor) * width), offsetY + hPart + MathHelper.floor((diffPitch / sFactor) * height), zLevel, width - (((int) (wPart * 1.5F))), height - (((int) (hPart * 1.5F))), 2, new RenderConstellation.BrightnessFunction() { @Override public float getBrightness() { return (0.3F + 0.7F * RenderConstellation.conCFlicker(ClientScheduler.getClientTick(), partialTicks, 5 + r.nextInt(15))) * transparency; } }, ResearchManager.clientProgress.hasConstellationDiscovered(topFound.getUnlocalizedName()), true); GL11.glDisable(GL11.GL_SCISSOR_TEST); } zLevel -= 1; } GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glPopAttrib(); return Optional.ofNullable(rectangles); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiHandTelescope.java
License:Open Source License
private void drawGridBackground(float partialTicks, boolean canSeeSky, float angleTransparency) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); Blending.PREALPHA.apply();//w ww.j a v a 2s. com World renderWorld = Minecraft.getMinecraft().world; int rgbFrom, rgbTo; if (canSeeSky && angleTransparency > 1.0E-4) { float starBr = renderWorld.getStarBrightness(partialTicks) * 2; float rain = renderWorld.getRainStrength(partialTicks); rgbFrom = RenderingUtils .clampToColorWithMultiplier(calcRGBFromWithRain(starBr, rain), angleTransparency).getRGB(); rgbTo = RenderingUtils.clampToColorWithMultiplier(calcRGBToWithRain(starBr, rain), angleTransparency) .getRGB(); } else { rgbFrom = 0x000000; rgbTo = 0x000000; } int alphaMask = 0xFF000000; //100% opacity. RenderingUtils.drawGradientRect(guiLeft + 4, guiTop + 4, zLevel, guiLeft + guiWidth - 4, guiTop + guiHeight - 4, new Color(alphaMask | rgbFrom), new Color(alphaMask | rgbTo)); Blending.DEFAULT.apply(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationCluster.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/* w ww. j ava 2 s. c o m*/ GL11.glEnable(GL11.GL_BLEND); drawDefault(textureResBlank); zLevel += 250; drawNavArrows(partialTicks); //fRend.zLevel = zLevel; //fRend.font_size_multiplicator = 0.07F; drawTitle(); rectCRenderMap.clear(); drawConstellations(); zLevel -= 250; GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalConstellationDetails.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from ww w.j a v a 2 s. c o m*/ GL11.glEnable(GL11.GL_BLEND); drawDefault(textureResBlank); zLevel += 150; drawBackArrow(partialTicks); drawConstellation(); drawPhaseInformation(); drawExtendedInformation(); zLevel -= 150; GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalPerkMap.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.thisFramePerks.clear(); Rectangle rectHover = new Rectangle(guiLeft + 10, guiTop + 5, guiWidth - 20, guiHeight - 10); if (rectHover.contains(mouseX, mouseY)) { mouseHoverPerc = Math.min(1F, mouseHoverPerc + mouseHoverMerge); } else {/* w w w .j a va 2s .c o m*/ mouseHoverPerc = Math.max(0F, mouseHoverPerc - mouseHoverMerge); } GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); Blending.DEFAULT.apply(); GL11.glColor4f(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); drawDefault(textureResShell); drawBaseBackground(zLevel - 50); if (mapToDisplay != null) { drawPerkMap(mapToDisplay, new Point(mouseX, mouseY)); } if (attunedConstellation != null) { drawOverlayTexture(attunedConstellation); } drawUnlockEffects(); TextureHelper.refreshTextureBindState(); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.GuiJournalProgression.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glPushMatrix();/*from w w w .j a v a 2s . co m*/ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); int cleanedX = mouseX - guiLeft; int cleanedY = mouseY - guiTop; if (Mouse.isButtonDown(0) && progressionRenderer.realRenderBox.isInBox(cleanedX, cleanedY)) { if (dragging) { progressionRenderer.moveMouse(-(cleanedX - bufX), -(cleanedY - bufY)); } else { bufX = cleanedX; bufY = cleanedY; dragging = true; } } else { progressionRenderer.applyMovedMouseOffset(); dragging = false; } //Zooming stuff. int dWheelChange = Mouse.getDWheel(); if (dWheelChange < 0) { progressionRenderer.handleZoomOut(); } if (dWheelChange > 0) { progressionRenderer.handleZoomIn(); } ScaledResolution res = new ScaledResolution(mc); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glScissor((guiLeft + 27) * res.getScaleFactor(), (guiTop + 27) * res.getScaleFactor(), (guiWidth - 54) * res.getScaleFactor(), (guiHeight - 54) * res.getScaleFactor()); progressionRenderer.drawProgressionPart(zLevel); GL11.glDisable(GL11.GL_SCISSOR_TEST); drawDefault(textureResShell); Rectangle guiStar = null; if (!ResearchManager.clientProgress.wasOnceAttuned()) { GL11.glDisable(GL11.GL_DEPTH_TEST); guiStar = IGuiRenderablePage.GUI_INTERFACE.drawInfoStar(guiLeft + guiWidth - 39, guiTop + 23, zLevel, 15, partialTicks); GL11.glEnable(GL11.GL_DEPTH_TEST); } zLevel += 150; drawMouseHighlight(zLevel, getCurrentMousePoint(), guiStar); zLevel -= 150; GL11.glPopAttrib(); GL11.glPopMatrix(); }