List of usage examples for org.lwjgl.opengl GL11 glPopMatrix
public static native void glPopMatrix();
From source file:arg.RenderRecipe.java
License:Open Source License
/** * Draws the screen and all the components in it. *//* w w w . ja v a 2 s . c om*/ @Override public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); int k = this.guiLeft; int l = this.guiTop; this.drawGuiContainerBackgroundLayer(par3, par1, par2); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); GL11.glTranslatef((float) k, (float) l, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); short short1 = 240; short short2 = 240; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F, (float) short2 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int i1; // crafting result drawSlotInventory((Slot) inventorySlots.inventorySlots.get(0)); incredientList.clear(); for (int j1 = 1; j1 < inventorySlots.inventorySlots.size(); ++j1) { Slot slot = (Slot) inventorySlots.inventorySlots.get(j1); drawSlotInventory(slot); } this.drawGuiContainerForegroundLayer(par1, par2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); }
From source file:arg.RenderRecipe.java
License:Open Source License
public void draw() { File dir = new File(Minecraft.getMinecraft().mcDataDir, "recipes"); if (!dir.exists() && !dir.mkdirs()) { throw new RuntimeException("The recipes directory could not be created: " + dir); }//from w w w. j a va2s . c o m name = name.replace(" ", ""); File file = new File(Minecraft.getMinecraft().mcDataDir, "recipes/" + name + ".png"); if (file.exists()) return; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushClientAttrib(GL11.GL_ALL_CLIENT_ATTRIB_BITS); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glViewport(0, 0, width, height); GL11.glOrtho(0.0D, xSize, ySize, 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glLineWidth(1.0F); GL11.glEnable(GL11.GL_COLOR_MATERIAL); try { drawScreen(0, 0, 0); } catch (Exception e) { e.printStackTrace(); } int[] pixels = new int[width * height]; int bindex; ByteBuffer fb = ByteBuffer.allocateDirect(width * height * 3); GL11.glReadPixels(0, 0, width, height, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, fb); GL11.glPopMatrix(); GL11.glPopAttrib(); GL11.glPopClientAttrib(); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); try { Display.swapBuffers(); } catch (LWJGLException e1) { e1.printStackTrace(); } BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int i = (x + (width * y)) * 3; int r = fb.get(i) & 0xFF; int g = fb.get(i + 1) & 0xFF; int b = fb.get(i + 2) & 0xFF; image.setRGB(x, height - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b); } } try { ImageIO.write(image, "png", file); } catch (Exception e) { e.printStackTrace(); } }
From source file:aritzh.afm.client.render.model.ModelTestModel.java
License:LGPL
public void render(final double x, final double y, final double z) { GL11.glPushMatrix();/*ww w. j a va 2 s. c o m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x + .5, y - .5, z + .5); FMLClientHandler.instance().getClient().renderEngine .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_TESTMODEL)); this.model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:aritzh.afm.client.render.model.ModelWireless.java
License:LGPL
public void render(final double x, final double y, final double z) { GL11.glPushMatrix();//from w w w . j a va 2s . c o m GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x + .5, y - .5, z + .5); FMLClientHandler.instance().getClient().renderEngine .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_WIRELESS)); this.model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:aroma1997.betterchests.client.BChestRenderer.java
License:Open Source License
public void renderTileEntityChestAt(TileEntityBChest par1TileEntityChest, double par2, double par4, double par6, float par8) { int i;/*from w w w .j a v a 2s . c om*/ if (!par1TileEntityChest.hasWorldObj()) { i = 0; } else { Block block = par1TileEntityChest.getBlockType(); i = par1TileEntityChest.getBlockMetadata(); if (block instanceof BlockChest && i == 0) { i = par1TileEntityChest.getBlockMetadata(); } } ModelChest modelchest = chestModel; bindTexture(model); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; if (i == 2) { short1 = 180; } if (i == 3) { short1 = 0; } if (i == 4) { short1 = 90; } if (i == 5) { short1 = -90; } GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); modelchest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:aroma1997.betterchests.upgrades.Blocking.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)/*from w w w.j a v a 2s . c om*/ public void draw(GuiContainer gui, ContainerBasic container, int par1, int par2, ItemStack item) { int blocked = item.stackSize * 9; GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F); GL11.glEnable(GL11.GL_BLEND); for (int i = 0; i < blocked; i++) { Slot slot = container.getSlot(i + 36); RenderHelper.renderTex(gui, Tex.REDCROSS, slot.xDisplayPosition - 1, slot.yDisplayPosition - 1); } GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:aroma1997.compactwindmills.rotors.WindmillRenderer.java
License:Open Source License
public void renderBlockRotor(TileEntityWindmill tileEntity, World world, int posX, int posY, int posZ, Block block) {/*from w ww . ja v a 2 s. com*/ if (tileEntity.getRotor() == null) { return; } model = new ModelRotor(tileEntity.getType().checkRadius); Tessellator tessellator = Tessellator.instance; float brightness = world.getBlockLightValue(posX, posY, posZ); int skyBrightness = world.getLightBrightnessForSkyBlocks(posX, posY + 1, posZ, 0); int skyBrightness1 = skyBrightness % 65536; int skyBrightness2 = skyBrightness / 65536; tessellator.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyBrightness1, skyBrightness2); short facing = tileEntity.getFacing(); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (facing == 2 || facing == 3 || facing == 4 || facing == 5) { int dir = facing == 4 ? 0 : facing == 2 ? 1 : facing == 5 ? 2 : facing; GL11.glRotatef(dir * -90F, 0F, 1F, 0F); } else if (facing == 1) { GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(360 - System.currentTimeMillis() / 30 % 360, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(-0.25F, 0.0F, 0.0F); bindTexture(tileEntity.getRotor().getRenderTexture()); model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:aroma1997.compactwindmills.rotors.WindmillRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float f) { GL11.glPushMatrix();/*from w w w.ja va 2s . c o m*/ GL11.glTranslatef((float) posX, (float) posY, (float) posZ); TileEntityWindmill tileEntityWindmill = (TileEntityWindmill) tileEntity; renderBlockRotor(tileEntityWindmill, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, CompactWindmills.windMill); GL11.glPopMatrix(); }
From source file:arrowsplus.client.render.RenderArrow.java
License:Open Source License
/** * Renders the arrow.//from w ww. ja va2 s . c o m * * @param entityArrow The arrow to render. * @param posX The x position to render the arrow at. * @param posY The y position to render the arrow at. * @param posZ The z position to render the arrow at. * @param yaw The yaw rotation to render the arrow with. * @param pitch The pitch to render the arrow with. */ public void renderArrow(EntityArrowBase entityArrow, double posX, double posY, double posZ, float yaw, float pitch) { this.func_110777_b(entityArrow); GL11.glPushMatrix(); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glRotatef(entityArrow.prevRotationYaw + (entityArrow.rotationYaw - entityArrow.prevRotationYaw) * pitch - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef( entityArrow.prevRotationPitch + (entityArrow.rotationPitch - entityArrow.prevRotationPitch) * pitch, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (0 + b0 * 10) / 32.0F; float f5 = (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (5 + b0 * 10) / 32.0F; float f9 = (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = entityArrow.arrowShake - pitch; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:basedefense.client.renderer.item.AbstractItemRenderer.java
License:Apache License
/** * {@inheritDoc}//from w w w . j a v a2s . c o m */ @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); { switch (type) { case ENTITY: this.renderEntity(item, data); break; case INVENTORY: this.renderInventory(item, data); break; case EQUIPPED: this.setupEquippedCommon(item, data); this.setupEquipped(item, data); this.renderEquipped(type, item, data); break; case EQUIPPED_FIRST_PERSON: this.setupEquippedCommon(item, data); this.setupEquippedFirstPerson(item, data); this.renderEquipped(type, item, data); break; } } GL11.glPopMatrix(); }