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:de.mineformers.robots.client.model.ModelBuddyBot.java
License:LGPL
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); if (this.isChild) { float f6 = 2.0F; GL11.glPushMatrix();//from www . ja va 2 s. c o m if (isSitting) GL11.glTranslatef(0, 0.325F, 0); GL11.glPushMatrix(); GL11.glScalef(1.75F / f6, 1.75F / f6, 1.75F / f6); GL11.glTranslatef(0.0F, 13.75F * par7, 0.0F); this.bipedHead.render(par7); this.bipedEye.render(par7); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6); GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); this.bipedBody.render(par7); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); this.bipedLeftLeg.render(par7); this.bipedHeadwear.render(par7); GL11.glPopMatrix(); GL11.glPopMatrix(); } else { GL11.glPushMatrix(); GL11.glScalef(2F, 2F, 2F); GL11.glTranslatef(0.0F, 16.0F * par7, 0.0F); this.bipedHead.render(par7); GL11.glPopMatrix(); this.bipedBody.render(par7); this.bipedRightArm.render(par7); this.bipedLeftArm.render(par7); this.bipedRightLeg.render(par7); this.bipedLeftLeg.render(par7); this.bipedHeadwear.render(par7); } }
From source file:de.mineformers.robots.client.renderer.entity.RenderRobot.java
License:LGPL
@Override protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) { super.renderModel(par1EntityLivingBase, par2, par3, par4, par5, par6, par7); EntityRobot robot = ((EntityRobot) par1EntityLivingBase); RenderHelper.bindTexture(robot.getChipset().getHeadTexture()); ((ModelRobot) mainModel).renderEye(false); Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix();//from ww w . j a v a 2s .com GL11.glTranslatef(0, 0.35F, -0.1F); GL11.glRotatef(180, 1, 0, 0); GL11.glScalef(0.5F, 0.5F, 1F); ItemStack itemstack = PrivateRobotHelper.createModuleStack(robot.getModule()); Icon icon = ModItems.module.getIcon(itemstack, 0); float f4 = icon.getMinU(); float f5 = icon.getMaxU(); float f6 = icon.getMinV(); float f7 = icon.getMaxV(); float f9 = 0.5F; float f10 = 0.25F; float f12 = 0.0625F; float f11 = 0.021875F; int j = itemstack.stackSize; byte b0 = customRenderItem.getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... GL11.glTranslatef(0f, 0f, f12 + f11); if (itemstack.getItemSpriteNumber() == 0) { RenderHelper.bindTexture(TextureMap.locationBlocksTexture); } else { RenderHelper.bindTexture(TextureMap.locationItemsTexture); } GL11.glColor4f(1, 1, 1, 1.0F); GL11.glRotatef(180, 0, 1, 0); GL11.glTranslatef(-1, 0, 0.05F); ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(), f12); if (itemstack.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:de.mineformers.robots.client.renderer.tileentity.TileFactoryControllerRenderer.java
License:LGPL
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTicks) { if (((TileFactoryController) tileentity).isValidMultiblock()) { GL11.glPushMatrix();//from www . j a v a 2s . c o m int i = 15728880; int j = i % 65536; int k = i / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glTranslated(x + 0.5F, y + 0.65F, z + 0.5f); switch (((TileFactoryController) tileentity).getOrientation()) { case WEST: GL11.glRotatef(90, 0, 1, 0); break; case EAST: GL11.glRotatef(-90, 0, 1, 0); break; case SOUTH: GL11.glRotatef(180, 0, 1, 0); break; } GL11.glTranslatef(0, 0, -0.47F); GL11.glScalef(0.3F, 0.3F, 0.3F); GL11.glRotatef(180, 1, 0, 0); GL11.glRotatef(180, 0, 1, 0); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(255F, 255F, 255F, 255F); this.bindTexture(robotTexture); robot.justRender(); GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
From source file:de.paleocrafter.netcraft.client.renderer.item.ItemArcPadRenderer.java
License:LGPL
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/*w w w. ja v a2s .com*/ FMLClientHandler.instance().getClient().renderEngine.bindTexture("/gui/items.png"); Icon icon = item.getItem().getIcon(item, 0); Tessellator tessellator = Tessellator.instance; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef(f6, f6, f6); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:de.paleocrafter.pcraft.client.renderer.item.ItemMachineRenderer.java
License:LGPL
private void renderMicroscope(float x, float y, float z) { FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_MICROSCOPE); GL11.glPushMatrix(); // start GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(x, y, z); // size GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glRotatef(180, 1, 0, 0);/*ww w . j a va 2 s. c o m*/ modelMicroscope.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); // end }
From source file:de.paleocrafter.pcraft.client.renderer.tileentity.TileEntityMachineRenderer.java
License:LGPL
private void renderAnalyzer(TileAnalyzer te, double x, double y, double z) { GL11.glPushMatrix();// w ww.j a v a2 s . c o m GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 2.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); ForgeDirection direction = te.getOrientation(); short angle = 0; if (direction != null) { if (direction == ForgeDirection.NORTH) { angle = 0; } else if (direction == ForgeDirection.SOUTH) { angle = 180; } else if (direction == ForgeDirection.WEST) { angle = -90; } else if (direction == ForgeDirection.EAST) { angle = 90; } } GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ANALYZER); modelAnalyzer.renderAll((int) Math.ceil(te.getProgress() / 10)); if (te.getState() == 1) { FMLClientHandler.instance().getClient().renderEngine .bindTexture(Textures.MODEL_LASER + ((int) Math.ceil(te.getProgress() / 10)) + ".png"); ModelRenderer laser = new ModelRenderer(modelAnalyzer, 0, 0); laser.addBox(-0.5F, 12.5F, -0.5F, 1, 10, 1); laser.setRotationPoint(0F, 0F, 0F); if (delta >= 0.9F) { Random rand = new Random(); float val = 1F; float rotX = 0; float rotZ = 0; while (val > 0.07F) { val = rand.nextFloat(); } rotX = val; val = 1F; while (val > 0.09F) { val = rand.nextFloat(); } rotZ = val; switch (rand.nextInt(4)) { case 0: rotZ *= -1; break; case 1: rotX *= -1; break; case 3: case 4: rotX *= -1; rotZ *= -1; break; } te.setLaserRotX(rotX); te.setLaserRotZ(rotZ); } setRotation(laser, te.getLaserRotX(), 0F, te.getLaserRotZ()); laser.setTextureSize(64, 32); laser.mirror = true; if (te.getFuelLevel() >= 2) { laser.render(0.0625F); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_FOSSIL); GL11.glTranslatef(-0.475F, 1.42F, 0.165F); GL11.glScalef(0.08F, 0.08F, 0.08F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); new ModelFossil().render(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:de.paleocrafter.pcraft.client.renderer.tileentity.TileEntityMachineRenderer.java
License:LGPL
private void renderMicroscope(TileMicroscope te, double x, double y, double z) { GL11.glPushMatrix();//from www .j av a2s . c om GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 2.0F, (float) z + 1.0F); GL11.glScalef(0.5F, -0.5F, -0.5F); GL11.glTranslatef(1F, 1F, 1F); ForgeDirection direction = te.getOrientation(); short angle = 0; if (direction != null) { if (direction == ForgeDirection.NORTH) { angle = -90; } else if (direction == ForgeDirection.SOUTH) { angle = 90; } else if (direction == ForgeDirection.WEST) { angle = 180; } else if (direction == ForgeDirection.EAST) { angle = 0; } } GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_MICROSCOPE); modelMicroscope.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:de.sanandrew.core.manpack.mod.client.gui.GuiUpdateDetails.java
License:Creative Commons License
@Override public void drawScreen(int mouseX, int mouseY, float partTicks) { int xPos = (this.width - 276) / 2; int yPos = (this.height - 240) / 2; int listX = 16; int listY = 60; int listWidth = 244; int listHeight = 150; int listTextY = 5; String s;/* w ww .j a v a 2s. co m*/ boolean isLeftMBDown = Mouse.isButtonDown(0); int scrollX = xPos + listX + listWidth - 4; int scrollY = yPos + listY; if (!this.isScrolling && isLeftMBDown && mouseX >= scrollX && mouseY >= scrollY && mouseX < scrollX + 4 && mouseY < scrollY + listHeight) { this.isScrolling = this.scrollMax > 0.0F; } if (!isLeftMBDown) { this.isScrolling = false; } if (this.isScrolling) { this.scrollAmount = Math.min(this.scrollMax, Math.max(0.0F, (mouseY - scrollY - 5) / (listHeight - 10.0F)) * scrollMax); } this.drawDefaultBackground(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Gui.drawRect(xPos, 0, xPos + 276, this.height, 0x80000000); GuiUtils.drawGradientRect(xPos, 0, xPos + 5, this.height, 0xFF000000, 0x00000000, this.zLevel); GuiUtils.drawGradientRect(xPos + 271, 0, xPos + 276, this.height, 0x00000000, 0xFF000000, this.zLevel); GL11.glPushMatrix(); GL11.glTranslatef(16.0F, 4.0F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.0F); GL11.glTranslatef(xPos / 1.5F - xPos, yPos / 1.5F - yPos, 0.0F); this.fontRendererObj.drawString(this.manager.getModName(), xPos, yPos, 0xFFFFFFFF); GL11.glPopMatrix(); s = "Currently installed version"; this.fontRendererObj.drawString(s, xPos + 16, yPos + 22, 0xFFA0A0A0); Gui.drawRect(xPos + this.fontRendererObj.getStringWidth(s) + 18, yPos + 26, xPos + 160, yPos + 27, 0xFF606060); s = "Updated version"; this.fontRendererObj.drawString(s, xPos + 16, yPos + 32, 0xFFA0A0A0); Gui.drawRect(xPos + this.fontRendererObj.getStringWidth(s) + 18, yPos + 36, xPos + 160, yPos + 37, 0xFF606060); this.fontRendererObj.drawString(this.manager.getVersion().toString(), xPos + 162, yPos + 22, 0xFFFFFFFF); this.fontRendererObj.drawString(this.manager.getUpdateInfo().version, xPos + 162, yPos + 32, 0xFFFFFFFF); this.fontRendererObj.drawString("Details and Changelog:", xPos + 16, yPos + 48, 0xFFA0A0A0); this.mc.renderEngine.bindTexture(TEXTURE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.drawTexturedModalRect(xPos + listX - 1, yPos + listY - 1, 0, 0, listWidth + 2, listHeight + 2); GuiUtils.doGlScissor(xPos + listX, yPos + listY, listWidth, listHeight); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -this.scrollAmount, 0.0F); s = this.manager.getUpdateInfo().description; this.fontRendererObj.drawSplitString(s, xPos + listX + 4, yPos + listY + listTextY + 2, listWidth - 12, 0xFFA00060); listTextY += this.fontRendererObj.splitStringWidth(s, listWidth - 12) + 4; if (this.manager.getUpdateInfo().changelog != null) { for (int i = 0; i < this.manager.getUpdateInfo().changelog.length; i++) { s = this.manager.getUpdateInfo().changelog[i]; Gui.drawRect(xPos + listX + 4, yPos + listY + listTextY + 4, xPos + listX + 8, yPos + listY + listTextY + 8, i % 2 == 0 ? 0xFF000000 : 0xFF606060); this.fontRendererObj.drawSplitString(s, xPos + listX + 14, yPos + listY + listTextY + 2, listWidth - 22, i % 2 == 0 ? 0xFF000000 : 0xFF606060); listTextY += this.fontRendererObj.splitStringWidth(s, listWidth - 22) + 2; } } this.scrollMax = listTextY - listHeight + 4; GL11.glPopMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); this.mc.renderEngine.bindTexture(TEXTURE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int scrollPos = (int) (this.scrollAmount / this.scrollMax * (listHeight - 10.0F)); this.drawTexturedModalRect(xPos + listX + listWidth - 4, yPos + listY + scrollPos, listWidth + 2, 0, 4, 10); GL11.glDisable(GL11.GL_BLEND); super.drawScreen(mouseX, mouseY, partTicks); }
From source file:de.sanandrew.core.manpack.mod.client.render.RenderSanPlayer.java
License:Creative Commons License
@Override protected void renderEquippedItems(AbstractClientPlayer player, float partTicks) { super.renderEquippedItems(player, partTicks); GL11.glPushMatrix();/* ww w. j av a2 s. c o m*/ this.myModel.body.postRender(0.0625F); ItemStack slot = player.inventory.getStackInSlot(0); if (slot != null && slot != player.getCurrentEquippedItem()) { GL11.glPushMatrix(); GL11.glRotatef(-80.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glTranslatef(-1.0F, -0.4F, 0.3F); ItemRenderHelper.renderItemIn3D(slot); GL11.glPopMatrix(); GL11.glTranslatef(0.0F, 0.0F, 0.05F); } slot = player.inventory.getStackInSlot(1); if (slot != null && slot != player.getCurrentEquippedItem()) { GL11.glPushMatrix(); GL11.glRotatef(-10.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glTranslatef(-0.6F, -0.0F, 0.3F); ItemRenderHelper.renderItemIn3D(slot); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:de.sanandrew.core.manpack.mod.client.render.RenderSanPlayer.java
License:Creative Commons License
@Override public void renderFirstPersonArm(EntityPlayer player) { GL11.glColor3f(1.0F, 1.0F, 1.0F);//from ww w. ja v a 2 s .c o m this.modelBipedMain.onGround = 0.0F; boolean isRidingPrev = this.modelBipedMain.isRiding; this.modelBipedMain.isRiding = false; this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player); this.modelBipedMain.isRiding = isRidingPrev; if (this.renderManager.renderEngine != null) { if (player.getCurrentArmor(2) != null) { this.bindTexture(this.getEntityTexture(player)); this.myModel.bipedLeftArm.render(0.0625F); String armoredChest = player.getCurrentArmor(2).getUnlocalizedName().replace(':', '_'); boolean prevArmR2Visible = this.myModel.armRight2.showModel; Minecraft.getMinecraft().getTextureManager().bindTexture( tryLoadArmorPiece("Chest", armoredChest, player, player.getCurrentArmor(2), 1)); this.myModel.bipedRightArm.render(0.0625F); GL11.glPushMatrix(); GL11.glScalef(1.05F, 1.05F, 1.05F); GL11.glTranslatef(0.015F, 0.00F, 0.0F); int armorColor = ((ItemArmor) player.getCurrentArmor(2).getItem()) .getColor(player.getCurrentArmor(2)); if (armorColor != -1) { float red = (armorColor >> 16 & 255) / 255.0F; float green = (armorColor >> 8 & 255) / 255.0F; float blue = (armorColor & 255) / 255.0F; GL11.glColor3f(red, green, blue); } else if (this.unknownTextureColorMap.containsKey(armoredChest)) { RGBAValues rgba = this.unknownTextureColorMap.get(armoredChest); GL11.glColor3f(rgba.getRed() / 255.0F, rgba.getGreen() / 255.0F, rgba.getBlue() / 255.0F); } this.myModel.armRight2.showModel = true; this.myModel.armRight2.render(0.0625F); this.myModel.armRight2.showModel = prevArmR2Visible; GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } else { boolean prevArmR2Visible = this.myModel.armRight2.showModel; this.bindTexture(this.getEntityTexture(player)); this.myModel.bipedRightArm.render(0.0625F); GL11.glPushMatrix(); GL11.glScalef(1.05F, 1.05F, 1.05F); GL11.glTranslatef(0.015F, 0.00F, 0.0F); this.myModel.armRight2.showModel = true; this.myModel.armRight2.render(0.0625F); this.myModel.armRight2.showModel = prevArmR2Visible; GL11.glPopMatrix(); } } }