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.journal.GuiJournalPages.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 www . java 2s. c om GL11.glEnable(GL11.GL_BLEND); if (origin != null) { drawDefault(textureResBlank); } else { drawWHRect(textureResBlank); } TextureHelper.refreshTextureBindState(); zLevel += 100; int pageOffsetY = 20; if (currentPageOffset == 0) { /*texUnderline.bind(); GL11.glPushMatrix(); GL11.glTranslated(guiLeft + 20, guiTop + 15, zLevel); drawTexturedRectAtCurrentPos(175, 6); GL11.glPopMatrix();*/ TextureHelper.refreshTextureBindState(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); String name = I18n.format(unlocTitle); double width = fontRenderer.getStringWidth(name); GL11.glTranslated(guiLeft + 117, guiTop + 22, 0); GL11.glScaled(1.3, 1.3, 1.3); GL11.glTranslated(-(width / 2), 0, 0); fontRenderer.drawString(name, 0, 0, 0x00DDDDDD);//Color.LIGHT_GRAY.getRGB()); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); texUnderline.bind(); GL11.glPushMatrix(); GL11.glTranslated(guiLeft + 30, guiTop + 35, zLevel); drawTexturedRectAtCurrentPos(175, 6); GL11.glPopMatrix(); pageOffsetY = 50; TextureHelper.refreshTextureBindState(); } int index = currentPageOffset * 2; if (pages.size() > index) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); IGuiRenderablePage page = pages.get(index); page.render(guiLeft + 30, guiTop + pageOffsetY, partialTicks, zLevel, mouseX, mouseY); GL11.glPopAttrib(); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } index = index + 1; if (pages.size() > index) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); IGuiRenderablePage page = pages.get(index); page.render(guiLeft + 220, guiTop + 20, partialTicks, zLevel, mouseX, mouseY); GL11.glPopAttrib(); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } index = currentPageOffset * 2; if (pages.size() > index) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); IGuiRenderablePage page = pages.get(index); page.postRender(guiLeft + 30, guiTop + pageOffsetY, partialTicks, zLevel, mouseX, mouseY); GL11.glPopAttrib(); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } index = index + 1; if (pages.size() > index) { GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); IGuiRenderablePage page = pages.get(index); page.postRender(guiLeft + 220, guiTop + 20, partialTicks, zLevel, mouseX, mouseY); GL11.glPopAttrib(); GL11.glPopMatrix(); TextureHelper.refreshTextureBindState(); } drawBackArrow(partialTicks); drawNavArrows(partialTicks); TextureHelper.refreshTextureBindState(); zLevel -= 100; GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiJournalPages.java
License:Open Source License
private void drawBackArrow(float partialTicks) { GL11.glDisable(GL11.GL_DEPTH_TEST);// w w w . ja v a 2 s . c om Point mouse = getCurrentMousePoint(); 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.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); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiJournalPages.java
License:Open Source License
private void drawNavArrows(float partialTicks) { GL11.glDisable(GL11.GL_DEPTH_TEST);/*from ww w. j av a2 s . c om*/ Point mouse = getCurrentMousePoint(); int cIndex = currentPageOffset * 2; rectNext = null; rectPrev = null; if (cIndex > 0) { int width = 30; int height = 15; rectPrev = new Rectangle(guiLeft + 25, guiTop + 220, 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.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(); } int nextIndex = cIndex + 2; if (pages.size() >= (nextIndex + 1)) { int width = 30; int height = 15; rectNext = new Rectangle(guiLeft + 367, guiTop + 220, 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.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); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionClusterRenderer.java
License:Open Source License
public void drawMouseHighlight(float zLevel, Point mousePoint) { Rectangle frame = new Rectangle(renderOffsetX, renderOffsetY, renderGuiWidth, renderGuiHeight); if (frame.contains(mousePoint)) { for (Rectangle r : clickableNodes.keySet()) { if (r.contains(mousePoint)) { GL11.glPushMatrix();//from w w w. j a va 2 s. c o m GL11.glTranslated(r.getX(), r.getY(), 0); GL11.glScaled(partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor()); String name = clickableNodes.get(r).getUnLocalizedName(); name = I18n.format(name); RenderingUtils.renderTooltip(0, 0, Lists.newArrayList(name), new Color(0x00100033), new Color(0xf0100010), Color.WHITE, Minecraft.getMinecraft().fontRenderer); GL11.glPopMatrix(); } } } }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionClusterRenderer.java
License:Open Source License
private void renderNodeToGUI(ResearchNode node, double lowerPosX, double lowerPosY, float zLevel) { double scaledLeft = this.mousePointScaled.getScaledPosX() - partSizeHandler.widthToBorder; double scaledTop = this.mousePointScaled.getScaledPosY() - partSizeHandler.heightToBorder; double xAdd = lowerPosX - scaledLeft; double yAdd = lowerPosY - scaledTop; double offsetX = renderOffsetX + xAdd; double offsetY = renderOffsetY + yAdd; GL11.glPushMatrix();/*www . ja v a 2s .c o m*/ GL11.glDepthMask(true); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); /*if(node.isSpecial()) { frameWooden.bind(); } else { frameBlank.bind(); }*/ frameWooden.bind(); double zoomedWH = partSizeHandler.getZoomedWHNode(); if (partSizeHandler.getScalingFactor() >= 0.7) { clickableNodes.put(new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(zoomedWH), MathHelper.floor(zoomedWH)), node); } drawResearchItemBackground(zoomedWH, xAdd, yAdd, zLevel); TextureHelper.refreshTextureBindState(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(offsetX, offsetY, 0); RenderItem ri = Minecraft.getMinecraft().getRenderItem(); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); switch (node.getRenderType()) { case ITEMSTACK: GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); GL11.glScaled(partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor()); GL11.glTranslated(3, 3, 3); GL11.glScaled(0.75, 0.75, 0.75); GL11.glColor4f(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); float oldZ = ri.zLevel; ri.zLevel = zLevel - 5; ri.renderItemIntoGUI(node.getRenderItemStack(ClientScheduler.getClientTick()), 0, 0); ri.zLevel = oldZ; GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glPopAttrib(); break; case TEXTURE: GlStateManager.disableAlpha(); GlStateManager.color(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); BindableResource tex = node.getTexture().resolve(); tex.bind(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, zoomedWH - 1, zLevel).tex(0, 1).endVertex(); vb.pos(zoomedWH - 1, zoomedWH - 1, zLevel).tex(1, 1).endVertex(); vb.pos(zoomedWH - 1, 0, zLevel).tex(1, 0).endVertex(); vb.pos(0, 0, zLevel).tex(0, 0).endVertex(); t.draw(); GlStateManager.color(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); GlStateManager.enableAlpha(); break; case TEXTURE_SPRITE: GlStateManager.disableAlpha(); GL11.glDisable(GL11.GL_ALPHA_TEST); GlStateManager.color(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); SpriteSheetResource res = node.getSpriteTexture().resolveSprite(); res.getResource().bind(); Tuple<Double, Double> uvTexture = res.getUVOffset(ClientScheduler.getClientTick()); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, zoomedWH, zLevel).tex(uvTexture.key, uvTexture.value + res.getVLength()).endVertex(); vb.pos(zoomedWH, zoomedWH, zLevel) .tex(uvTexture.key + res.getULength(), uvTexture.value + res.getVLength()).endVertex(); vb.pos(zoomedWH, 0, zLevel).tex(uvTexture.key + res.getULength(), uvTexture.value).endVertex(); vb.pos(0, 0, zLevel).tex(uvTexture.key, uvTexture.value).endVertex(); t.draw(); GlStateManager.color(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); GlStateManager.enableAlpha(); break; } GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionRenderer.java
License:Open Source License
public void drawProgressionPart(float zLevel) { drawBaseBackground(zLevel);//from w w w . java2 s .c o m drawClusters(zLevel); focusedClusterMouse = tryFocusCluster(); double scaleX = this.mousePointScaled.getPosX(); double scaleY = this.mousePointScaled.getPosY(); if (sizeHandler.getScalingFactor() >= 6.1D && focusedClusterZoom != null && clusterRenderer != null) { ClientJournalMapping.JournalCluster cluster = ClientJournalMapping .getClusterMapping(focusedClusterZoom); drawClusterBackground(cluster.clusterBackgroundTexture, zLevel); clusterRenderer.drawClusterScreen(zLevel); scaleX = clusterRenderer.getScaleMouseX(); scaleY = clusterRenderer.getScaleMouseY(); } if (focusedClusterMouse != null) { ClientJournalMapping.JournalCluster cluster = ClientJournalMapping .getClusterMapping(focusedClusterMouse); if (cluster != null) { double lX = sizeHandler.evRelativePosX(cluster.leftMost); double rX = sizeHandler.evRelativePosX(cluster.rightMost); double lY = sizeHandler.evRelativePosY(cluster.upperMost); double rY = sizeHandler.evRelativePosY(cluster.lowerMost); double scaledLeft = this.mousePointScaled.getScaledPosX() - sizeHandler.widthToBorder; double scaledTop = this.mousePointScaled.getScaledPosY() - sizeHandler.heightToBorder; double xAdd = lX - scaledLeft; double yAdd = lY - scaledTop; double offsetX = realCoordLowerX + xAdd; double offsetY = realCoordLowerY + yAdd; double scale = sizeHandler.getScalingFactor(); float br = 1F; if (scale > 8.01) { br = 0F; } else if (scale >= 6) { br = (float) (1F - ((scale - 6) / 2)); } String name = focusedClusterMouse.getUnlocalizedName(); name = I18n.format(name); TextureHelper.refreshTextureBindState(); GL11.glPushMatrix(); GL11.glTranslated(offsetX + ((rX - lX) / 2), offsetY + ((rY - lY) / 3), 0); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int width = fr.getStringWidth(name); GL11.glTranslated(-width / 2, 0, 0); GL11.glScaled(1.4, 1.4, 1.4); int alpha = 0xCC; alpha *= br; alpha = Math.max(alpha, 5); int color = 0x5A28FF | (alpha << 24); fr.drawStringWithShadow(name, 0, 0, color); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); //Resetting. GL11.glColor4f(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); } /*if(clusterText != null && !clusterText.getText().equalsIgnoreCase(name)) { clusterText = null; } if(clusterText == null) { clusterText = new OverlayText(name, name.length() * 10, new OverlayText.OverlayTextProperties() .setPolicy(OverlayTextPolicy.Policies.WRITING) .setColor(new Color(90, 40, 255)) .setAlpha(1F)); }*/ } // else { /*if(clusterText != null && clusterText.canRemove()) { clusterText = null; }*/ //} /*if(clusterText != null) { Point mouse = parentGui.getCurrentMousePoint(); GL11.glPushMatrix(); GL11.glTranslated(mouse.x, mouse.y - 18, 0); GL11.glScaled(0.8, 0.8, 0.8); clusterText.doRender(null, 0, false); GL11.glPopMatrix(); }*/ drawBlendedStarfieldLayers(scaleX, scaleY, zLevel); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionRenderer.java
License:Open Source License
private void renderCluster(ResearchProgression p, ClientJournalMapping.JournalCluster cluster, double lowerPosX, double lowerPosY, double higherPosX, double higherPosY, float zLevel) { double scaledLeft = this.mousePointScaled.getScaledPosX() - sizeHandler.widthToBorder; double scaledTop = this.mousePointScaled.getScaledPosY() - sizeHandler.heightToBorder; double xAdd = lowerPosX - scaledLeft; double yAdd = lowerPosY - scaledTop; double offsetX = realCoordLowerX + xAdd; double offsetY = realCoordLowerY + yAdd; GL11.glPushMatrix();/* w ww .j a va 2 s . c o m*/ GL11.glTranslated(offsetX, offsetY, 0); double width = higherPosX - lowerPosX; double height = higherPosY - lowerPosY; Rectangle r = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(width), MathHelper.floor(height)); clusterRectMap.put(r, p); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); cluster.cloudTexture.bind(); double scale = sizeHandler.getScalingFactor(); float br = 1F; if (scale > 8.01) { br = 0F; } else if (scale >= 6) { br = (float) (1F - ((scale - 6) / 2)); } GL11.glColor4f(br, br, br, br); Blending.ADDITIVEDARK.apply(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, height, zLevel).tex(0, 1).endVertex(); vb.pos(width, height, zLevel).tex(1, 1).endVertex(); vb.pos(width, 0, zLevel).tex(1, 0).endVertex(); vb.pos(0, 0, zLevel).tex(0, 0).endVertex(); t.draw(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiScreenJournal.java
License:Open Source License
private Rectangle drawBookmark(double offsetX, double offsetY, double width, double height, double mouseOverWidth, float zLevel, String title, int titleRGBColor, Point mousePoint) { TextureHelper.setActiveTextureToAtlasSprite(); //Reset styles, because MC fontrenderer is STUPID A F if (titleRGBColor == Color.WHITE.getRGB()) { fontRenderer.drawString("", 0, 0, Color.BLACK.getRGB()); } else {//from w w w . ja v a 2 s .c om fontRenderer.drawString("", 0, 0, Color.WHITE.getRGB()); } GL11.glPushMatrix(); GL11.glColor4f(1F, 1F, 1F, 1F); GlStateManager.color(1F, 1F, 1F, 1F); textureBookmark.bind(); Rectangle r = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(width), MathHelper.floor(height)); if (r.contains(mousePoint)) { if (mouseOverWidth > width) { textureBookmarkStr.bind(); } width = mouseOverWidth; r = new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(width), MathHelper.floor(height)); } Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); vb.begin(7, DefaultVertexFormats.POSITION_TEX); vb.pos(offsetX, offsetY + height, zLevel).tex(0, 1).endVertex(); vb.pos(offsetX + width, offsetY + height, zLevel).tex(1, 1).endVertex(); vb.pos(offsetX + width, offsetY, zLevel).tex(1, 0).endVertex(); vb.pos(offsetX, offsetY, zLevel).tex(0, 0).endVertex(); tes.draw(); GL11.glPushMatrix(); GL11.glTranslated(offsetX + 2, offsetY + 4, zLevel + 50); GL11.glScaled(0.7, 0.7, 0.7); fontRenderer.drawString(I18n.format(title), 0, 0, titleRGBColor); GL11.glPopMatrix(); GlStateManager.color(1F, 1F, 1F, 1F); GL11.glPopMatrix(); return r; }
From source file:hellfirepvp.astralsorcery.client.render.tile.TESRAltar.java
License:Open Source License
private void renderT3Additions(TileAltar te, double x, double y, double z, double jump) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from w ww . j a v a 2 s . co m GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5); GL11.glRotated(180, 1, 0, 0); GL11.glScaled(0.0625, 0.0625, 0.0625); RenderHelper.disableStandardItemLighting(); GlStateManager.pushMatrix(); //GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); texAltar3.bind(); modelAltar3.render(null, (float) jump, 0, 0, 0, 0, 1F); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.render.tile.TESRAltar.java
License:Open Source License
private void renderT2Additions(TileAltar te, double x, double y, double z, double jump) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();//from w w w . j a v a 2 s . c o m GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5); GL11.glRotated(180, 1, 0, 0); GL11.glScaled(0.0625, 0.0625, 0.0625); RenderHelper.disableStandardItemLighting(); GlStateManager.pushMatrix(); //GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); texAltar2.bind(); modelAltar2.render(null, (float) jump, 0, 0, 0, 0, 1F); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); GL11.glPopAttrib(); }