List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderOnbashira.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();// ww w. j a v a 2s. c o m GL11.glTranslatef(0F, -0.7F, -0.5F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float s = 0.5F; GL11.glScalef(s, s, s); GL11.glRotatef(0F, 0F, 0F, 0F); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityOnbashira(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:arekkuusu.grimoireOfAlice.client.render.LargeItemRenderer.java
License:Open Source License
private void doTheStuff(ItemStack stack, EntityLivingBase entity, boolean view) { GL11.glPushMatrix();/*ww w . j a v a 2 s . c o m*/ double size = scale; if (view) { size *= 1.75F; GL11.glTranslated(-0.35F * scale, -0.125F * scale, 0.0F); } else { size *= (entity instanceof EntityPlayer ? 2.0F : 1.75F); GL11.glTranslated(1.0D - size, -0.125D * scale, 0.05D * scale); if (rotate != 0) { GL11.glTranslated(2.0D - size, -2.125D * scale, 0.05D * scale); GL11.glTranslatef(0, 4, 0); GL11.glTranslated(1.2, -2, -0.1); } } GL11.glScaled(size, size, size); IIcon icon = stack.getItem().getIcon(stack, 0); Tessellator tessellator = Tessellator.instance; ItemRenderer.renderItemIn2D(tessellator, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F); GL11.glPopMatrix(); }
From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyKeyStone.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) { GL11.glPushMatrix();//from w w w. j av a2 s .c o m GL11.glTranslatef((float) x + 0.5F, (float) y + 1.4F, (float) z + 0.5F); GL11.glRotatef(180, 0F, 0f, 1f); bindTexture(TEXTURE); MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F); GL11.glPopMatrix(); }
From source file:arekkuusu.grimoireOfAlice.client.render.RenderHolyStone.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) { GL11.glPushMatrix();/*from w w w . ja v a2s .c o m*/ GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180, 0F, 0f, 1f); bindTexture(TEXTURE); GL11.glPushMatrix(); MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:arekkuusu.grimoireOfAlice.client.render.RenderOnbashira.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float p_147500_8_) { GL11.glPushMatrix();// w ww . j av a2 s. c o m GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180, 0F, 0f, 1f); bindTexture(TEXTURE); MODEL.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F); GL11.glPopMatrix(); }
From source file:arg.RenderRecipe.java
License:Open Source License
/** * Draws the screen and all the components in it. *///from w ww . j a v a2s .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 .jav a2 s . 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:aroma1997.betterchests.client.BChestRenderer.java
License:Open Source License
public void renderTileEntityChestAt(TileEntityBChest par1TileEntityChest, double par2, double par4, double par6, float par8) { int i;//ww w. j a v a 2 s. 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.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 w w.j av a2 s. c om*/ 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 . j av a 2 s . co 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(); }