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:com.kegare.caveworld.client.renderer.RenderCaveman.java
License:Minecraft Mod Public
@Override public void doRender(Entity entity, double par2, double par3, double par4, float par5, float par6) { super.doRender(entity, par2, par3, par4, par5, par6); if (Config.cavemanShowHealthBar && entity instanceof EntityCaveman) { Minecraft mc = FMLClientHandler.instance().getClient(); EntityPlayer player = mc.thePlayer; EntityCaveman living = (EntityCaveman) entity; if (living.isTamed() && player.getGameProfile().getId().toString() .equals(Strings.nullToEmpty(living.func_152113_b())) && living.getEntitySenses().canSee(player) && living.getDistanceToEntity(player) <= 3.5F && mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY && mc.objectMouseOver.entityHit == living) { float scale = 0.01666667F * 1.5F; int width = 15; double top = 5.0D; double under = top + 2.0D; GL11.glPushMatrix();/*from w w w . ja v a 2 s . co m*/ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par3 + 2.3F, (float) par4); GL11.glNormal3f(0.0F, 1.0F, 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.glScalef(-scale, -scale, scale); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, (living.isSittingAndStopped() ? 0.6F : 0.12F) / scale, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); int x = living.getBrightnessForRender((float) par2); int y = x % 65536; int z = x / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, y / 1.0F, z / 1.0F); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 115); tessellator.addVertex(-width - 1, top - 0.5D, 0.0D); tessellator.addVertex(-width - 1, under + 0.5D, 0.0D); tessellator.addVertex(width + 1, under + 0.5D, 0.0D); tessellator.addVertex(width + 1, top - 0.5D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); Tessellator tessellator1 = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); float max = living.getMaxHealth(); int health = (int) (2.0D * width * living.getHealth() / max); if (renderHealth < 0.0D) { renderHealth = health; } else { double dh = renderHealth - health; double distance = Math.abs(Math.sqrt(dh * dh)); if ((int) renderHealth < health) { if (distance > 10.0D) { renderHealth += 0.35D; } else if (distance < 1.5D) { renderHealth += 0.01D; } else { renderHealth += 0.1D; } } else if ((int) renderHealth > health) { if (distance > 10.0D) { renderHealth -= 0.35D; } else if (distance < 1.5D) { renderHealth -= 0.01D; } else { renderHealth -= 0.1D; } } } int color = Color.GREEN.getRGB(); if (renderHealth < max / 4) { color = Color.RED.getRGB(); } else if (renderHealth < max / 2) { color = Color.YELLOW.getRGB(); } tessellator1.startDrawingQuads(); tessellator1.setColorRGBA_I(color, 145); tessellator1.addVertex(-width, top, 0.0D); tessellator1.addVertex(-width, under, 0.0D); tessellator1.addVertex(-width + renderHealth, under, 0.0D); tessellator1.addVertex(-width + renderHealth, top, 0.0D); tessellator1.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } else { renderHealth = -1.0D; } } }
From source file:com.kegare.caveworld.client.renderer.RenderMiningPickaxe.java
License:Minecraft Mod Public
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { FontRenderer renderer = item.getItem().getFontRenderer(item); if (renderer == null) { renderer = mc.fontRenderer;// ww w . j a v a 2 s. c o m } itemRender.renderItemIntoGUI(renderer, mc.getTextureManager(), item, 0, 0, true); Item base = ((ItemMiningPickaxe) item.getItem()).getBaseTool(item); if (base != CaveItems.mining_pickaxe) { GL11.glPushMatrix(); GL11.glTranslatef(-9.0F, 14.0F, -9.0F); GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); itemRender.renderItemIntoGUI(renderer, mc.getTextureManager(), new ItemStack(base), 0, item.isItemDamaged() ? 13 : 16, true); GL11.glPopMatrix(); } String refined = Roman.toRoman(((ItemMiningPickaxe) item.getItem()).getRefined(item)); if (!Strings.isNullOrEmpty(refined)) { GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glPushMatrix(); GL11.glTranslatef(5.0F, 5.0F, 5.0F); GL11.glScalef(0.8F, 0.8F, 0.8F); renderer.drawStringWithShadow(refined, 16 - renderer.getStringWidth(refined) - 2, item.isItemDamaged() ? 3 : 6, 0xEEEEEE); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } }
From source file:com.kegare.frozenland.client.renderer.RenderIceball.java
License:Minecraft Mod Public
@Override public void doRender(Entity entity, double posX, double posY, double posZ, float yaw, float ticks) { IIcon icon = Items.snowball.getIconFromDamage(0); if (icon != null) { GL11.glPushMatrix();// www. j av a 2s . c o m GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); bindEntityTexture(entity); Tessellator tessellator = Tessellator.instance; int i = 0x95CBE7; float r = (i >> 16 & 255) / 255.0F; float g = (i >> 8 & 255) / 255.0F; float b = (i & 255) / 255.0F; GL11.glColor3f(r, g, b); GL11.glPushMatrix(); doRender(tessellator, icon); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
From source file:com.mcgoodtime.productionline.client.RenderEntityThrowable.java
License:MIT License
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. *//*from ww w . ja va2 s . c om*/ @Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { IIcon iicon = entity.getDataWatcher().getWatchableObjectItemStack(23).getIconIndex(); if (iicon != null) { GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(entity); Tessellator tessellator = Tessellator.instance; if (iicon == ItemPotion.func_94589_d("bottle_splash")) { int i = PotionHelper.func_77915_a(((EntityPotion) entity).getPotionDamage(), false); float f2 = (float) (i >> 16 & 255) / 255.0F; float f3 = (float) (i >> 8 & 255) / 255.0F; float f4 = (float) (i & 255) / 255.0F; GL11.glColor3f(f2, f3, f4); GL11.glPushMatrix(); this.draw(tessellator, ItemPotion.func_94589_d("overlay")); GL11.glPopMatrix(); GL11.glColor3f(1.0F, 1.0F, 1.0F); } this.draw(tessellator, iicon); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
From source file:com.minestellar.core.render.tile.TileEntityRenderAntenna.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { this.bindTexture(new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/antenna.png")); GL11.glPushMatrix();/*from w w w .j a v a 2 s . com*/ GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); modelAntenna.renderModel(0.0625F); // model.render(null, 0.04F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:com.minestellar.core.render.tile.TileEntityRenderComputer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { this.bindTexture(new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/computer.png")); GL11.glPushMatrix();/*from www . j a v a 2 s . c o m*/ GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); model.renderModel(0.0625F); GL11.glPopMatrix(); }
From source file:com.minestellar.core.render.tile.TileEntityRenderGasSink.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { texture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/gasSink.png"); this.bindTexture(texture); GL11.glPushMatrix();//w w w. j a va 2s . c om GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); model.renderModel(0.0625F); // model.render(null, 0.04F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:com.minestellar.core.render.tile.TileEntityRenderOxygenCollector.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { texture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/oxygenCollector.png"); this.bindTexture(texture); GL11.glPushMatrix();/*from w w w . jav a2 s. c om*/ GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); model.renderModel(0.0625F); GL11.glPopMatrix(); }
From source file:com.minestellar.core.render.tile.TileEntityRenderSolarPanel.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tile, double translationX, double translationY, double translationZ, float f) { texture = new ResourceLocation(MinestellarCore.TEXTURE_PREFIX + "textures/model/tile/solarPanel.png"); this.bindTexture(texture); GL11.glPushMatrix();//from w ww .ja va2s.co m GL11.glTranslatef((float) translationX + 0.5F, (float) translationY + 1.5F, (float) translationZ + 0.5F); GL11.glScalef(1.0F, -1F, -1F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); model.render(null, 0.04F, 1.0F, 1.0F, 1.0F, 1.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:com.minestellar.moon.world.SkyRendererMoon.java
License:Open Source License
@Override public void render(float partialTicks, WorldClient world, Minecraft mc) { WorldProviderMoon gcProvider = null; if (world.provider instanceof WorldProviderMoon) { gcProvider = (WorldProviderMoon) world.provider; }/*w ww .ja v a 2s . c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1, 1, 1); final Tessellator var23 = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_FOG); GL11.glColor3f(0, 0, 0); GL11.glCallList(this.glSkyList); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.disableStandardItemLighting(); float var10; float var11; float var12; float var20 = 0; if (gcProvider != null) { var20 = gcProvider.getStarBrightness(partialTicks); } if (var20 > 0.0F) { GL11.glColor4f(1.0F, 1.0F, 1.0F, var20); GL11.glCallList(this.starGLCallList); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); GL11.glPopMatrix(); GL11.glPushMatrix(); // SUN: GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F); GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); var12 = 30.0F; FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.sunTexture); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D); var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D); var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D); var23.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_BLEND); // EARTH: var12 = 50.0F; final float earthRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F; GL11.glScalef(0.6F, 0.6F, 0.6F); GL11.glRotatef(earthRotation, 1.0F, 0.0F, 0.0F); GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.earthTexture); world.getMoonPhase(); var23.startDrawingQuads(); var23.addVertexWithUV(-var12, -400.0D, var12, 0, 1); var23.addVertexWithUV(var12, -400.0D, var12, 1, 1); var23.addVertexWithUV(var12, -400.0D, -var12, 1, 0); var23.addVertexWithUV(-var12, -400.0D, -var12, 0, 0); var23.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_FOG); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.0F, 0.0F, 0.0F); final double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); if (var25 < 0.0D) { GL11.glPushMatrix(); GL11.glTranslatef(0.0F, 12.0F, 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); var10 = 1.0F; var11 = -((float) (var25 + 65.0D)); var12 = -var10; var23.startDrawingQuads(); var23.setColorRGBA_I(0, 255); var23.addVertex(-var10, var11, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var12, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(var10, var12, -var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var11, var10); var23.addVertex(var10, var11, -var10); var23.addVertex(-var10, var11, -var10); var23.addVertex(-var10, var11, var10); var23.addVertex(-var10, var12, var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, -var10); var23.addVertex(-var10, var12, var10); var23.addVertex(var10, var12, var10); var23.addVertex(var10, var12, -var10); var23.draw(); } GL11.glColor3f(70F / 256F, 70F / 256F, 70F / 256F); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F); GL11.glCallList(this.glSkyList2); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); }