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:de.sanandrew.mods.claysoldiers.client.render.entity.mount.RenderHorseMount.java
License:Creative Commons License
@Override protected void preRenderCallback(EntityLivingBase livingBase, float partTicks) { GL11.glTranslatef(0.0F, 0.36F, 0.0F); GL11.glScalef(0.5F, 0.5F, 0.5F); }
From source file:de.sanandrew.mods.claysoldiers.client.render.entity.projectile.RenderBlockProjectile.java
License:Creative Commons License
@Override public void doRender(Entity entity, double x, double y, double z, float yaw, float partTicks) { int blockX = MathHelper.floor_double(entity.posX); int blockY = MathHelper.floor_double(entity.posY); int blockZ = MathHelper.floor_double(entity.posZ); GL11.glPushMatrix();/* w w w . ja va 2s. co m*/ GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glScalef(0.1F, 0.1F, 0.1F); this.bindEntityTexture(entity); GL11.glDisable(GL11.GL_LIGHTING); this.p_renderBlocks.setRenderBoundsFromBlock(this.p_block); this.p_renderBlocks.renderBlockSandFalling(this.p_block, entity.worldObj, blockX, blockY, blockZ, 0); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.item.ItemRendererClayNexus.java
License:Creative Commons License
private void renderNexus(float x, float y, float z) { GL11.glPushMatrix();/*ww w . j a v a 2 s. c o m*/ GL11.glTranslatef(x, y + 1.57F + 0.125F, z); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.1875F, 1.1875F, 1.1875F); Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_TEXTURE); this.modelClayNexus.renderTileEntity(); Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_GLOWING); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); this.modelClayNexus.renderTileEntityGlowmap(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partTicks) { TileEntityClayNexus nexus = (TileEntityClayNexus) tileEntity; GL11.glPushMatrix();//from w w w .ja v a 2s .c o m GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); this.bindTexture(Textures.NEXUS_TEXTURE); nexusModel.renderTileEntity(); this.renderGlowmap(nexus); if (nexus.getStackInSlot(TileEntityClayNexus.SOLDIER_SLOT) != null) { renderSoldierItem(nexus, nexus.getStackInSlot(TileEntityClayNexus.SOLDIER_SLOT), partTicks); } if (nexus.getStackInSlot(TileEntityClayNexus.THROWABLE_SLOT) != null) { renderThrowableItem(nexus, nexus.getStackInSlot(TileEntityClayNexus.THROWABLE_SLOT), partTicks); } ItemStack heldItem = Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(); if (heldItem != null && heldItem.getItem() == RegistryItems.statDisplay) { renderHealth(nexus); } GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java
License:Creative Commons License
private static void renderSoldierItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) { float[] colors = new float[] { 1.0F, 1.0F, 1.0F }; float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F; RGBAValues rgba = SAPUtils.getRgbaFromColorInt(ItemClayManDoll.getTeam(stack).getIconColor()); colors[0] = rgba.getRed() / 255.0F;// w ww . j av a 2 s .c o m colors[1] = rgba.getGreen() / 255.0F; colors[2] = rgba.getBlue() / 255.0F; GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 1.225F, 0.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(0.25F, 0.25F, 0.25F); GL11.glRotatef(itmAngle, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, 0.0F, 0.0F); GL11.glColor3f(colors[0], colors[1], colors[2]); ItemRenderHelper.renderItemIn3D(stack); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java
License:Creative Commons License
private static void renderThrowableItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) { float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F; ASoldierUpgrade upg = SoldierUpgrades.getUpgrade(stack); IThrowableUpgrade throwableUpg = upg instanceof IThrowableUpgrade ? (IThrowableUpgrade) upg : null; if (throwableUpg == null) { return;/*from www . j a v a 2s. co m*/ } GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 0.875F, 0.0F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(0.25F, 0.25F, 0.25F); GL11.glRotatef(-itmAngle, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, 0.0F, 0.0F); GL11.glColor3f(1.0F, 1.0F, 1.0F); throwableUpg.renderNexusThrowable(nexus, partTicks); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java
License:Creative Commons License
private static void renderHealth(TileEntityClayNexus nexus) { Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix();//ww w .j av a 2s . c o m GL11.glTranslatef(0.0F, 0.5F, 0.0F); GL11.glRotatef(RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); float healthPerc = Math.min(1.0F, 1.0F - nexus.getHealth() / nexus.getMaxHealth()); float prevBrightX = OpenGlHelper.lastBrightnessX; float prevBrightY = OpenGlHelper.lastBrightnessY; int brightness = 0xF0; int brightX = brightness % 65536; int brightY = brightness / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-0.5D, -0.05D, 0.0D); tessellator.addVertex(-0.5D + healthPerc, -0.05D, 0.0D); tessellator.addVertex(-0.5D + healthPerc, 0.05D, 0.0D); tessellator.addVertex(-0.5D, 0.05D, 0.0D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(1.0F, 0.0F, 0.0F, 1.0F); tessellator.addVertex(-0.5D + healthPerc, -0.05D, 0.0D); tessellator.addVertex(0.5D, -0.05D, 0.0D); tessellator.addVertex(0.5D, 0.05D, 0.0D); tessellator.addVertex(-0.5D + healthPerc, 0.05D, 0.0D); tessellator.draw(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.enderstuffp.client.gui.GuiBiomeChanger.java
License:Creative Commons License
@Override public void drawScreen(int mouseX, int mouseY, float partTicks) { int currFlux = this.biomeChanger.getEnergyStored(ForgeDirection.UNKNOWN); int maxFlux = this.biomeChanger.getMaxEnergyStored(ForgeDirection.UNKNOWN); int fluxUsage = this.biomeChanger.getFluxUsage(); int fluxScale = 40 - (int) (currFlux / (float) maxFlux * 40.0F); int bufferScale = fluxUsage > 0 ? 40 - (int) (this.biomeChanger.usedFlux / (fluxUsage * 20.0F) * 40.0F) : 40;//ww w. ja va2 s . c o m this.drawDefaultBackground(); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glPushMatrix(); GL11.glTranslatef(this.posX, this.posY, 0.0F); this.mc.renderEngine.bindTexture(EnumTextures.GUI_BIOMECHANGER.getResource()); this.drawTexturedModalRect(0, 0, 0, 0, WIDTH, HEIGHT); this.drawTexturedModalRect(10, 20, 176, 0, 14, 42); this.drawTexturedModalRect(14, 21 + fluxScale, 194, 1 + fluxScale, 9, 40 - fluxScale); this.drawTexturedModalRect(11, 21 + bufferScale, 191, 1 + bufferScale, 3, 40 - bufferScale); this.drawTexturedModalRect(7, 75, 0, 240, 161, 5); this.drawTexturedModalRect(7, 75, 0, 245, Math.round(161.0F * (this.biomeChanger.getCurrRange() / (float) this.biomeChanger.getMaxRange())), 5); this.mc.fontRenderer.drawString(SAPUtils.translate(this.biomeChanger.getInventoryName()), 8, 6, 0x404040); String unlocName = EspBlocks.biomeChanger.getUnlocalizedName() + ".gui."; this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.usage"), 28, 21, 0x707070); this.mc.fontRenderer.drawString(String.format("%d RF/t", fluxUsage), 33, 31, 0x000000); this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "flux.stored"), 28, 43, 0x707070); this.mc.fontRenderer.drawString(String.format("%d %s(+%d)%s / %d RF", currFlux, EnumChatFormatting.DARK_GREEN, this.biomeChanger.usedFlux, EnumChatFormatting.RESET, maxFlux), 33, 53, 0x000000); this.mc.fontRenderer.drawString(SAPUtils.translate(unlocName + "progress"), 10, 66, 0x404040); String s = String.format("%d / %d", this.biomeChanger.getCurrRange(), this.biomeChanger.getMaxRange()); GuiUtils.drawOutlinedString(numberFont, s, 7 + (161 - numberFont.getStringWidth(s)) / 2, 74, 0xA090FF, 0x000000); s = SAPUtils.translate(unlocName + "perim"); drawRect(14, 88, 17 + this.mc.fontRenderer.getStringWidth(s), 88 + this.mc.fontRenderer.FONT_HEIGHT, 0xFFC6C6C6); this.mc.fontRenderer.drawString(s, 16, 88, 0x404040); s = SAPUtils.translatePostFormat(unlocName + "blockrepl", this.biomeChanger.isReplacingBlocks() ? EnumChatFormatting.DARK_GREEN + SAPUtils.translate(unlocName + "blockrepl.label.enabled") : EnumChatFormatting.DARK_RED + SAPUtils.translate(unlocName + "blockrepl.label.disabled")); this.mc.fontRenderer.drawString(s, 10, 179, 0x404040); GL11.glPopMatrix(); this.buttons.get(BTN_DEACTIVATE).visible = this.biomeChanger.isActive(); this.buttons.get(BTN_ACTIVATE).visible = !this.biomeChanger.isActive(); this.buttons.get(BTN_BLOCKREPL_DISABLE).enabled = this.biomeChanger.isReplacingBlocks() && !this.biomeChanger.isActive(); this.buttons.get(BTN_BLOCKREPL_ENABLE).enabled = !this.biomeChanger.isReplacingBlocks() && !this.biomeChanger.isActive(); this.buttons.get(BTN_SLIDER_RANGE).enabled = !this.biomeChanger.isActive(); this.buttons.get(BTN_PERIM_CIRCLE).enabled = this.biomeChanger.perimForm != EnumPerimForm.CIRCLE && !this.biomeChanger.isActive(); this.buttons.get(BTN_PERIM_RHOMBUS).enabled = this.biomeChanger.perimForm != EnumPerimForm.RHOMBUS && !this.biomeChanger.isActive(); this.buttons.get(BTN_PERIM_SQUARE).enabled = this.biomeChanger.perimForm != EnumPerimForm.SQUARE && !this.biomeChanger.isActive(); super.drawScreen(mouseX, mouseY, partTicks); if (this.biomeChanger.isActive()) { drawRect(this.posX + 10, this.posY + 88, this.posX + 170, this.posY + 210, 0x80C6C6C6); } }
From source file:de.sanandrew.mods.enderstuffp.client.gui.GuiOreGenerator.java
License:Creative Commons License
@Override protected void drawGuiContainerBackgroundLayer(float partTicks, int mouseX, int mouseY) { GL11.glPushMatrix();/* w w w.ja v a 2 s . com*/ GL11.glTranslatef(this.guiLeft, this.guiTop, 0.0F); this.mc.renderEngine.bindTexture(EnumTextures.GUI_ORE_GENERATOR.getResource()); this.drawTexturedModalRect(0, 0, 0, 0, this.xSize, this.ySize); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.enderstuffp.client.render.ItemRendererBiomeDataCrystal.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { int biomeId = item.hasTagCompound() ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_BIOME) : -1;//from w w w.j ava 2 s . c o m int dataProgress = item.hasTagCompound() ? item.getTagCompound().getShort(ItemBlockBiomeDataCrystal.NBT_DATAPROG) : 0; double minCore = 3.0D / 16.0D; double maxCore = 13.0D / 16.0D; switch (type) { case ENTITY: GL11.glTranslatef(-0.5F, -0.508F, -0.5F); break; case INVENTORY: GL11.glTranslatef(0.0F, -0.1F, 0.0F); break; } GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); if (dataProgress > 0 && biomeId >= 0) { double yMax = (10.0D - dataProgress) / 16.0F; double tessVMax = dataProgress / 10.0F * 0.5F; float[] color = SAPUtils.getRgbaFromColorInt(BiomeGenBase.getBiome(biomeId).color).getColorFloatArray(); GL11.glColor3f(color[0], color[1], color[2]); Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_CORE.getResource()); SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore - yMax, 0.25D, 0.0D, 0.5D, 0.5D); SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.5D, 0.0D, 0.75D, 0.5D); SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore - yMax, maxCore, maxCore, 0.25D, 1.0D - tessVMax, 0.5D, 1.0D); SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore - yMax, maxCore, minCore, 0.75D, 1.0D - tessVMax, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore - yMax, maxCore, 0.0D, 1.0D - tessVMax, 0.25D, 1.0D); SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore - yMax, minCore, 0.5D, 1.0D - tessVMax, 0.75D, 1.0D); GL11.glColor3f(1.0F, 1.0F, 1.0F); } minCore -= 0.0001D; maxCore += 0.0001D; Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.GLASS_TEXTURE); SAPClientUtils.drawTexturedSquareYPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareYNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareXPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareXNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareZPos(minCore, minCore, maxCore, maxCore, maxCore, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareZNeg(minCore, minCore, maxCore, maxCore, minCore, 0.0D, 0.0D, 1.0D, 1.0D); Minecraft.getMinecraft().renderEngine.bindTexture(EnumTextures.BIOMECRYSTAL_BLOCKTEXTURE); SAPClientUtils.drawTexturedSquareYPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareYNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareXPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareXNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareZPos(0.0D, 0.0D, 1.0D, 1.0D, 1.0D, 0.0D, 0.0D, 1.0D, 1.0D); SAPClientUtils.drawTexturedSquareZNeg(0.0D, 0.0D, 1.0D, 1.0D, 0.0D, 0.0D, 0.0D, 1.0D, 1.0D); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); }