List of usage examples for org.lwjgl.opengl GL11 glScalef
public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:appeng.client.render.items.ToolColorApplicatorRender.java
License:Open Source License
@Override public void renderItem(final ItemRenderType type, final ItemStack item, final Object... data) { final IIcon par2Icon = item.getIconIndex(); float f4 = par2Icon.getMinU(); float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); final Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix();/*from w w w . j av a 2 s.c om*/ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); if (type == ItemRenderType.INVENTORY) { GL11.glColor4f(1, 1, 1, 1.0F); GL11.glScalef(16F, 16F, 10F); GL11.glTranslatef(0.0F, 1.0F, 0.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_ALPHA_TEST); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); tessellator.addVertexWithUV(0, 0, 0, f4, f7); tessellator.addVertexWithUV(1, 0, 0, f5, f7); tessellator.addVertexWithUV(1, 1, 0, f5, f6); tessellator.addVertexWithUV(0, 1, 0, f4, f6); tessellator.draw(); } else { if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(0.0F, 0.0F, 0.0F); } else if (type == ItemRenderType.EQUIPPED) { GL11.glTranslatef(0.0F, 0.0F, 0.0F); } else { GL11.glTranslatef(-0.5F, -0.3F, 0.01F); } final float f12 = 0.0625F; ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glColor4f(1, 1, 1, 1.0F); GL11.glScalef(-1F, -1F, 1F); GL11.glTranslatef(-1.125F, 0.0f, f12 / -2.0f); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); } final IIcon dark = ExtraItemTextures.ToolColorApplicatorTip_Dark.getIcon(); final IIcon med = ExtraItemTextures.ToolColorApplicatorTip_Medium.getIcon(); final IIcon light = ExtraItemTextures.ToolColorApplicatorTip_Light.getIcon(); GL11.glScalef(1F / 16F, 1F / 16F, 1F); if (type != ItemRenderType.INVENTORY) { GL11.glTranslatef(2, 0, 0); } GL11.glDisable(GL11.GL_LIGHTING); final AEColor col = ((ToolColorApplicator) item.getItem()).getActiveColor(item); if (col != null) { tessellator.startDrawingQuads(); f4 = dark.getMinU(); f5 = dark.getMaxU(); f6 = dark.getMinV(); f7 = dark.getMaxV(); tessellator.setColorOpaque_I(col.blackVariant); tessellator.addVertexWithUV(0, 0, 0, f4, f7); tessellator.addVertexWithUV(16, 0, 0, f5, f7); tessellator.addVertexWithUV(16, 16, 0, f5, f6); tessellator.addVertexWithUV(0, 16, 0, f4, f6); f4 = light.getMinU(); f5 = light.getMaxU(); f6 = light.getMinV(); f7 = light.getMaxV(); tessellator.setColorOpaque_I(col.whiteVariant); tessellator.addVertexWithUV(0, 0, 0, f4, f7); tessellator.addVertexWithUV(16, 0, 0, f5, f7); tessellator.addVertexWithUV(16, 16, 0, f5, f6); tessellator.addVertexWithUV(0, 16, 0, f4, f6); f4 = med.getMinU(); f5 = med.getMaxU(); f6 = med.getMinV(); f7 = med.getMaxV(); tessellator.setColorOpaque_I(col.mediumVariant); tessellator.addVertexWithUV(0, 0, 0, f4, f7); tessellator.addVertexWithUV(16, 0, 0, f5, f7); tessellator.addVertexWithUV(16, 16, 0, f5, f6); tessellator.addVertexWithUV(0, 16, 0, f4, f6); tessellator.draw(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:appeng.client.render.items.ToolWirelessTerminalRender.java
License:Open Source License
@Override public void renderItem(final ItemRenderType type, final ItemStack item, final Object... data) { Entity itemLocation = item.getItemFrame(); if (itemLocation == null) { itemLocation = Minecraft.getMinecraft().thePlayer; }//from w w w. j a va 2 s . c om final boolean displayAntenna = ((ToolWirelessTerminal) item.getItem()).getIsUsable(item, itemLocation); final boolean hasPower = ((ToolWirelessTerminal) item.getItem()).hasPower(null, 0.5, item); IIcon border; if (displayAntenna) { border = ExtraItemTextures.WirelessTerminal_Border.getIcon(); } else { border = ExtraItemTextures.WirelessTerminal_Border_Inactive.getIcon(); } final IIcon scrollBar = ExtraItemTextures.WirelessTerminal_ScrollBar.getIcon(); final IIcon icons = ExtraItemTextures.WirelessTerminal_Icons.getIcon(); IIcon screen = ExtraItemTextures.WirelessTerminal_Screen.getIcon(); final AEColor color = ToolWirelessTerminal.getColor(item); if (color == null) { screen = item.getIconIndex(); } final Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); //translate stuff for different item render types if (type != ItemRenderType.INVENTORY) { if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(0.0F, 0.0F, 0.0F); } else if (type == ItemRenderType.EQUIPPED) { GL11.glTranslatef(0.0F, 0.0F, 0.0F); } else { GL11.glTranslatef(-0.5F, -0.3F, 0.01F); } } else { GL11.glColor4f(1, 1, 1, 1.0F); GL11.glScalef(16F, 16F, 10F); GL11.glTranslatef(0.0F, 1.0F, 0.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); GL11.glEnable(GL11.GL_ALPHA_TEST); } final float f12 = 0.0625F; //Border, which is uncolored subRenderItem(type, tessellator, border, f12); if (hasPower) { RenderHelper.disableStandardItemLighting(); } //If a terminal isn't colored, use the default icon which doesn't require icons or scrollbar if (color != null) { //Icons, which are dark colored { final int blackColor = color.blackVariant; final float r = (blackColor >> 16) & 0xFF; final float g = (blackColor >> 8) & 0xFF; final float b = blackColor & 0xFF; GL11.glColor3f(r / 256.0f, g / 256.0f, b / 256.0f); subRenderItem(type, tessellator, icons, f12); } //Scrollbar, which is medium colored { final int medColor = color.mediumVariant; final float r = (medColor >> 16) & 0xFF; final float g = (medColor >> 8) & 0xFF; final float b = medColor & 0xFF; GL11.glColor3f(r / 256.0f, g / 256.0f, b / 256.0f); subRenderItem(type, tessellator, scrollBar, f12); } } //Screen, which is light colored { if (color != null) { final int whiteColor = color.whiteVariant; final float r = (whiteColor >> 16) & 0xFF; final float g = (whiteColor >> 8) & 0xFF; final float b = whiteColor & 0xFF; GL11.glColor3f(r / 256.0f, g / 256.0f, b / 256.0f); } subRenderItem(type, tessellator, screen, f12); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:appeng.entity.RenderTinyTNTPrimed.java
License:Open Source License
private void renderPrimedTNT(final EntityTinyTNTPrimed tnt, final double x, final double y, final double z, final float life) { GL11.glPushMatrix();// w ww. jav a 2 s .c om GL11.glTranslatef((float) x, (float) y - 0.25f, (float) z); float f2; if (tnt.fuse - life + 1.0F < 10.0F) { f2 = 1.0F - (tnt.fuse - life + 1.0F) / 10.0F; if (f2 < 0.0F) { f2 = 0.0F; } if (f2 > 1.0F) { f2 = 1.0F; } f2 *= f2; f2 *= f2; final float f3 = 1.0F + f2 * 0.3F; GL11.glScalef(f3, f3, f3); } GL11.glScalef(0.5f, 0.5f, 0.5f); f2 = (1.0F - (tnt.fuse - life + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(tnt); this.blockRenderer.renderBlockAsItem(Blocks.tnt, 0, tnt.getBrightness(life)); if (tnt.fuse / 5 % 2 == 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); this.blockRenderer.renderBlockAsItem(Blocks.tnt, 0, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glPopMatrix(); }
From source file:appeng.parts.reporting.AbstractPartMonitor.java
License:Open Source License
private void tesrRenderScreen(final Tessellator tess, final IAEItemStack ais) { // GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS ); final ForgeDirection d = this.getSide(); GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77); switch (d) {/*from w w w . ja va2 s.c o m*/ case UP: GL11.glScalef(1.0f, -1.0f, 1.0f); GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(this.getSpin() * 90.0F, 0, 0, 1); break; case DOWN: GL11.glScalef(1.0f, -1.0f, 1.0f); GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(this.getSpin() * -90.0F, 0, 0, 1); break; case EAST: GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f); break; case WEST: GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f); break; case NORTH: GL11.glScalef(-1.0f, -1.0f, -1.0f); break; case SOUTH: GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); break; default: break; } try { final ItemStack sis = ais.getItemStack(); sis.stackSize = 1; final int br = 16 << 20 | 16 << 4; final int var11 = br % 65536; final int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL12.GL_RESCALE_NORMAL); // RenderHelper.enableGUIStandardItemLighting(); tess.setColorOpaque_F(1.0f, 1.0f, 1.0f); ClientHelper.proxy.doRenderItem(sis, this.getTile().getWorldObj()); } catch (final Exception e) { AELog.error(e); } finally { GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } GL11.glTranslatef(0.0f, 0.14f, -0.24f); GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f); final long stackSize = ais.getStackSize(); final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize); final FontRenderer fr = Minecraft.getMinecraft().fontRenderer; final int width = fr.getStringWidth(renderedStackSize); GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f); fr.drawString(renderedStackSize, 0, 0, 0); // GL11.glPopAttrib(); }
From source file:appeng.parts.reporting.PartStorageMonitor.java
License:Open Source License
private void tesrRenderScreen(Tessellator tess, IAEItemStack ais) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); ForgeDirection d = this.side; GL11.glTranslated(d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77); if (d == ForgeDirection.UP) { GL11.glScalef(1.0f, -1.0f, 1.0f); GL11.glRotatef(90.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(this.spin * 90.0F, 0, 0, 1); }//from www. jav a 2s. c o m if (d == ForgeDirection.DOWN) { GL11.glScalef(1.0f, -1.0f, 1.0f); GL11.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(this.spin * -90.0F, 0, 0, 1); } if (d == ForgeDirection.EAST) { GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f); } if (d == ForgeDirection.WEST) { GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f); } if (d == ForgeDirection.NORTH) { GL11.glScalef(-1.0f, -1.0f, -1.0f); } if (d == ForgeDirection.SOUTH) { GL11.glScalef(-1.0f, -1.0f, -1.0f); GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); } GL11.glPushMatrix(); try { ItemStack sis = ais.getItemStack(); sis.stackSize = 1; int br = 16 << 20 | 16 << 4; int var11 = br % 65536; int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11 * 0.8F, var12 * 0.8F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL12.GL_RESCALE_NORMAL); // RenderHelper.enableGUIStandardItemLighting(); tess.setColorOpaque_F(1.0f, 1.0f, 1.0f); ClientHelper.proxy.doRenderItem(sis, this.tile.getWorldObj()); } catch (Exception e) { AELog.error(e); } GL11.glPopMatrix(); GL11.glTranslatef(0.0f, 0.14f, -0.24f); GL11.glScalef(1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f); final long stackSize = ais.getStackSize(); final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm(stackSize); FontRenderer fr = Minecraft.getMinecraft().fontRenderer; int width = fr.getStringWidth(renderedStackSize); GL11.glTranslatef(-0.5f * width, 0.0f, -1.0f); fr.drawString(renderedStackSize, 0, 0, 0); GL11.glPopAttrib(); }
From source file:arekkuusu.grimoireOfAlice.client.render.ItemRenderHolyStone.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/*from w ww .j a v a 2 s . c o m*/ GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float s = 1.4F; GL11.glScalef(s, s, s); GL11.glRotatef(-5F, 1F, 0F, 0F); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityHolyStone(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
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();//from www. ja 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:arg.RenderRecipe.java
License:Open Source License
@Override public void drawGuiContainerForegroundLayer(int i, int j) { super.drawGuiContainerForegroundLayer(i, j); String title = LanguageRegistry.instance() .getStringLocalization(getCraftingContainer().craftResult.getStackInSlot(0).getDisplayName()); fontRenderer.drawString(title, getCenteredOffset(title, xSize), 5, 0x404040); float scale = 3 / 4F; // since we scale by 1/2, we have to start on *2 int[] baseX = { (int) (10 * (1F / scale)), (int) (100 * (1F / scale)) }; int baseY = (int) (76 * (1F / scale)); GL11.glScalef(scale, scale, 1.0F); int item = 0; int y = baseY; for (Entry<String, ItemStack> entry : incredientList.entrySet()) { int x = baseX[incredientList.size() < 5 ? 0 : (item < incredientList.size() / 2 ? 0 : 1)]; if (incredientList.size() < 5 ? false : (item == incredientList.size() / 2)) y = baseY;// ww w . jav a 2 s . c o m String name = entry.getKey(); if (incredientList.size() >= 5) name = fontRenderer.trimStringToWidth(name, (int) ((100 - 10 - 18) * (1F / scale))); fontRenderer.drawString(name, x + 18, y + 4, 0x404040); drawItemStackAtPosition(entry.getValue(), x, y); y += 18; item++; } GL11.glScalef(1F / scale, 1F / scale, 1.0F); }
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 av a 2s .co m*/ 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:arrowsplus.client.render.RenderArrow.java
License:Open Source License
/** * Renders the arrow./*from w w w . j a v a 2 s . c om*/ * * @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(); }