List of usage examples for org.lwjgl.opengl GL11 glPopMatrix
public static native void glPopMatrix();
From source file:cn.academy.crafting.client.render.item.RendererMatterUnit.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { ItemMatterUnit item = ModuleCrafting.matterUnit; GL11.glColor4d(1, 1, 1, 1);/*from w ww.j a v a2s.c o m*/ if (type != ItemRenderType.INVENTORY) { GL11.glPushMatrix(); { if (type == ItemRenderType.ENTITY) GL11.glTranslated(-.5, -0.1, 0); RenderUtils.drawEquippedItem(stack, 0.0625f); GL11.glColorMask(false, false, false, false); RenderUtils.drawEquippedItem(0.0626f, texMask, texMask); GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_EQUAL); MatterMaterial mat = item.getMaterial(stack); RenderUtils.drawEquippedItemOverlay(0.0626f, mat.texture); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glPopMatrix(); } else { ShaderMask shader = ShaderMask.instance; float du = -(GameTimer.getAbsTime() % 10000L) / 1e4f, dv = (GameTimer.getAbsTime() % 10000L) / 1e4f; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.renderItemInventory(stack); shader.start(texMask); RenderUtils.loadTexture(item.getMaterial(stack).texture); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0 + du, 0 + dv); shader.maskTexCoord(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(0 + du, 1 + dv); shader.maskTexCoord(0, 1); GL11.glVertex2f(0, 16); GL11.glTexCoord2f(1 + du, 1 + dv); shader.maskTexCoord(1, 1); GL11.glVertex2f(16, 16); GL11.glTexCoord2f(1 + du, 0 + dv); shader.maskTexCoord(1, 0); GL11.glVertex2f(16, 0); GL11.glEnd(); shader.end(); GL11.glDisable(GL11.GL_BLEND); } }
From source file:cn.academy.energy.client.app.FreqTransmitterUI.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { double width = sr.getScaledWidth_double(), height = sr.getScaledHeight_double(); AppFreqTransmitter app = AppFreqTransmitter.instance; GL11.glPushMatrix();/* ww w . jav a2 s . co m*/ { GL11.glTranslated(15, 15, 0); final float isize = 18; final FontOption option = new FontOption(10); String str = app.getDisplayName(); double len = font.getTextWidth(str, option); drawBox(0, 0, 30 + len, 18); ResourceLocation icon = app.getIcon(); RenderUtils.loadTexture(icon); GL11.glColor4d(1, 1, 1, 1); HudUtils.rect(2, 0, isize, isize); font.draw(str, isize + 6, 4, option); } GL11.glPopMatrix(); current.handleDraw(width, height); long dt = current.getDeltaTime(); if (dt > current.timeout) { setState(new StateNotifyAndQuit("st")); } GL11.glColor4d(1, 1, 1, 1); }
From source file:cn.academy.energy.client.gui.EnergyUIHelper.java
License:GNU General Public License
public static void drawTextBox(String str, double x, double y, double limit, FontOption option, boolean mono) { GL11.glEnable(GL11.GL_BLEND);// w ww.jav a 2 s .com final IFont font = Resources.font(); Extent extent = font.drawSeperated_Sim(str, limit, option); if (extent.linesDrawn == 0) { extent.height = option.fontSize; } double X0 = x, Y0 = y, MARGIN = Math.min(5, option.fontSize * 0.3); X0 -= extent.width * option.align.lenOffset; drawBox(X0, Y0, MARGIN * 2 + extent.width, MARGIN * 2 + extent.height, mono); GL11.glPushMatrix(); GL11.glTranslated(0, 0, 1); font.drawSeperated(str, x + MARGIN, Y0 + MARGIN, limit, option); GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.gui.GuiPhaseGen.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { GL11.glPushMatrix();/*from w w w . ja v a 2 s.c om*/ GL11.glTranslated(-guiLeft, -guiTop, 0); Widget w = gui.getTopWidget(x, y); if (w != null) { String text = null; switch (w.getName()) { case "prog_liquid": text = tile.getLiquidAmount() + "/" + tile.getTankSize() + "mB"; break; case "prog_buffer": text = String.format("%.1f/%.1fIF", tile.getEnergy(), tile.bufferSize); break; } if (text != null) { //int offsetX = -160, offsetY = -45; GL11.glEnable(GL11.GL_BLEND); EnergyUIHelper.drawTextBox(text, x + 5, y + 5, 10); } } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.gui.matrix.GuiMatrix.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { GL11.glPushMatrix();/* ww w . j a va 2s . com*/ GL11.glTranslated(-guiLeft, -guiTop, 0); Widget w = gui.getTopWidget(x, y); if (w != null) { String text = null; switch (w.getName()) { case "progress_cap": text = local("capacity") + ": " + nodes + "/" + tile.getCapacity(); break; case "progress_lat": text = local("bandwidth") + String.format(": %.1f IF/t", tile.getBandwidth()); break; case "progress_ran": text = local("range") + String.format(": %.2fm", tile.getRange()); break; default: break; } if (text != null) { this.drawHoveringText(Arrays.asList(new String[] { text }), x, y, this.fontRendererObj); } } GL11.glPopMatrix(); if (GameTimer.getTime() - syncedTime > 1200) GuiMatrixSync.sendSyncRequest(this); }
From source file:cn.academy.energy.client.gui.node.GuiNode.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { GL11.glPushMatrix();//from w w w . j av a 2s . c om GL11.glTranslated(-guiLeft, -guiTop, 0); Widget w = gui.getTopWidget(x, y); if (w != null) { String text = null; switch (w.getName()) { case "progress_load": text = load + "/" + maxLoad; break; case "progress_imag": text = String.format("%.1f/%.1fIF", tile.getEnergy(), tile.getMaxEnergy()); break; case "btn_edit": text = local("rename"); break; case "button_confirm": text = StatCollector.translateToLocal("ac.network.link"); break; case "button_config": text = StatCollector.translateToLocal("ac.network.search"); break; } if (text != null) { EnergyUIHelper.drawTextBox(text, x + 5, y, 9); } } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.gui.wind.GuiWindGenBase.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { GL11.glPushMatrix();/*ww w .j a v a2 s. c om*/ GL11.glTranslated(-guiLeft, -guiTop, 0); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); Widget w = gui.getTopWidget(x, y); if (w != null) { String text = null; switch (w.getName()) { case "prog_fancap": text = getFanCap() + "/" + ModuleEnergy.windgenFan.getMaxDamage(); break; case "prog_speed": text = tile.getSimulatedGeneration() + "IF/T"; break; case "prog_buffer": text = String.format("%.1f/%.1fIF", tile.getEnergy(), tile.bufferSize); break; } if (text != null) { //int offsetX = -160, offsetY = -45; EnergyUIHelper.drawTextBox(text, x + 5, y, 10); } } GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.block.RenderCatEngine.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float pt) { long time = GameTimer.getTime(); TileCatEngine engine = (TileCatEngine) tile; if (engine.lastRender != 0) { engine.rotation += (time - engine.lastRender) * engine.thisTickGen * 1e-2; //System.out.println(engine.thisTickGen); engine.rotation %= 360;/*w w w .j av a2 s.co m*/ } engine.lastRender = time; x += 0.5; z += 0.5; GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslated(x, y + 0.03 * Math.sin(GameTimer.getTime() * 0.006), z); double yaw = Math.atan2(x, z) * 180 / Math.PI; GL11.glRotated(yaw + 180, 0, 1, 0); GL11.glTranslated(0, .5, 0); GL11.glRotated(engine.rotation, 1, 0, 0); GL11.glTranslated(-.5, -.5, 0); Tessellator t = Tessellator.instance; RenderUtils.loadTexture(TEXTURE); t.startDrawingQuads(); t.addVertexWithUV(0, 0, 0, 0, 0); t.addVertexWithUV(1, 0, 0, 1, 0); t.addVertexWithUV(1, 1, 0, 1, 1); t.addVertexWithUV(0, 1, 0, 0, 1); t.draw(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.block.RenderMatrix.java
License:GNU General Public License
@Override public void drawAtOrigin(TileEntity te) { TileMatrix matrix = (TileMatrix) te; GL11.glPushMatrix();// ww w.j ava 2 s . co m RenderUtils.loadTexture(texture); drawBase(matrix); drawShields(matrix); GL11.glPopMatrix(); }
From source file:cn.academy.energy.client.render.block.RenderMatrix.java
License:GNU General Public License
private void drawShields(TileMatrix mat) { int plateCount = mat.plateCount == 3 ? 3 : 0; long time = GameTimer.getTime(); double dtheta = 360.0 / plateCount, phase = (time / 20.0) % 360; double htPhaseOff = 40.0; for (int i = 0; i < plateCount; ++i) { GL11.glPushMatrix();/*from w ww. j a v a 2s . co m*/ double floatHeight = 0.1; GL11.glTranslated(0, floatHeight * Math.sin(time / 900.0 + htPhaseOff * i), 0); GL11.glRotated(phase + dtheta * i, 0, 1, 0); model.renderPart("Shield"); GL11.glPopMatrix(); } }