List of usage examples for org.lwjgl.opengl GL11 glScaled
public static native void glScaled(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:buildcraftAdditions.client.render.BucketItemRenderer.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemBucketBCA)) return;//from w w w . j av a 2 s . c o m ItemBucketBCA bucket = (ItemBucketBCA) item.getItem(); Fluid fluid = null; boolean gaseous = false; if (bucket.getFluid() != null) { fluid = bucket.getFluid().getFluid(); if (fluid != null && (fluid.isGaseous() || fluid.getDensity() < 0)) gaseous = true; } IIcon overlay = bucket.getOverlay(); IIcon bucketIcon = Items.bucket.getIconFromDamage(0); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glRotated(180, 0, 0, 1); GL11.glTranslated(-1, -1, 0); } else if (type.equals(ItemRenderType.ENTITY)) { GL11.glRotated(180, 0, 0, 1); GL11.glRotated(90, 0, 1, 0); GL11.glTranslated(-0.5, -0.9, 0); if (item.isOnItemFrame()) { GL11.glTranslated(0.075, 0.475, 0); GL11.glScaled(0.85, 0.85, 0.85); } } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glTranslated(1, 1, 0); GL11.glRotated(180, 0, 0, 1); } if (fluid != null) { Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); renderMask(overlay, fluid.getIcon(), type, gaseous); } Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); if (!type.equals(ItemRenderType.INVENTORY)) { if (gaseous) ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMaxU(), bucketIcon.getMinV(), bucketIcon.getMinU(), bucketIcon.getMaxV(), bucketIcon.getIconWidth(), bucketIcon.getIconHeight(), 0.0625F); else ItemRenderer.renderItemIn2D(Tessellator.instance, bucketIcon.getMinU(), bucketIcon.getMaxV(), bucketIcon.getMaxU(), bucketIcon.getMinV(), bucketIcon.getIconWidth(), bucketIcon.getIconHeight(), 0.0625F); } else renderIcon(bucketIcon, 0, gaseous); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.CanisterItemRender.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { IIcon overlay = canister.overlay;//www . ja v a 2 s. c o m IIcon cannister = canister.getIconFromDamage(0); GL11.glPushMatrix(); if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); GL11.glTranslated(-1.0D, -1.0D, 0.0D); } else if (type.equals(ItemRenderType.ENTITY)) { GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D); GL11.glTranslated(-0.5D, -0.9D, 0.0D); if (item.isOnItemFrame()) { GL11.glTranslated(0.1D, 0.4D, 0.0D); GL11.glScaled(0.85D, 0.85D, 0.85D); } } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glTranslated(1.0D, 1.0D, 0.0D); GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); } if (item.stackTagCompound != null && item.getTagCompound().hasKey("Fluid")) { Fluid fluid = FluidRegistry .getFluid(item.stackTagCompound.getCompoundTag("Fluid").getString("FluidName")); if (fluid != null) { Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); renderMask(overlay, fluid.getIcon(), type); } } Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); if (!type.equals(ItemRenderType.INVENTORY)) ItemRenderer.renderItemIn2D(Tessellator.instance, cannister.getMinU(), cannister.getMaxV(), cannister.getMaxU(), cannister.getMinV(), cannister.getIconWidth(), cannister.getIconHeight(), 0.0625F); else renderIcon(cannister, 0.0D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.entities.EntityLaserShotRenderer.java
License:GNU General Public License
private void doRender(EntityLaserShot entity, double x, double y, double z, float rotation, float partialTicks) { bindEntityTexture(entity);/*from ww w.ja v a2s.c om*/ GL11.glPushMatrix(); float strength = entity.getStrength(); if (strength >= 1) GL11.glColor3f(1, 0, 0); else if (strength > 0.75) GL11.glColor3f(0.75F, 0, 0.25F); else if (strength > 0.6) GL11.glColor3f(0.5F, 0, 0.5F); else if (strength > 0.35) GL11.glColor3f(0.25F, 0, 0.75F); else GL11.glColor3f(0, 0, 1); GL11.glTranslated(x, y, z); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90, 0, 1, 0); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0, 0, 1); Tessellator t = Tessellator.instance; double d1 = 0; double d2 = 0.5; double d3 = 0 / 32D; double d4 = 5 / 32D; double d5 = 0.05625; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f1 = entity.throwableShake - partialTicks; if (f1 > 0) { float f2 = -MathHelper.sin(f1 * 3) * f1; GL11.glRotatef(f2, 0, 0, 1); } GL11.glRotatef(45, 1, 0, 0); GL11.glScaled(d5, d5, d5); GL11.glTranslatef(-4, 0, 0); for (int i = 0; i < 4; i++) { GL11.glRotatef(90, 1, 0, 0); GL11.glNormal3d(0, 0, d5); t.startDrawingQuads(); t.addVertexWithUV(-8, -2, 0, d1, d3); t.addVertexWithUV(8, -2, 0, d2, d3); t.addVertexWithUV(8, 2, 0, d2, d4); t.addVertexWithUV(-8, 2, 0, d1, d4); t.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.items.CanisterItemRender.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (item == null || item.getItem() == null || !(item.getItem() instanceof ItemCanister)) return;// ww w. j a v a2s . c o m ItemCanister canister = (ItemCanister) item.getItem(); IIcon overlay = canister.getOverlay(); IIcon canisterIcon = canister.getIconFromDamage(0); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_ALPHA_TEST); if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glRotated(180, 0, 0, 1); GL11.glTranslated(-1, -1, 0); } else if (type.equals(ItemRenderType.ENTITY)) { GL11.glRotated(180, 0, 0, 1); GL11.glRotated(90, 0, 1, 0); GL11.glTranslated(-0.5, -0.9, 0); if (item.isOnItemFrame()) { GL11.glTranslated(0.075, 0.475, 0); GL11.glScaled(0.85, 0.85, 0.85); } } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glTranslated(1, 1, 0); GL11.glRotated(180, 0, 0, 1); } FluidStack fluid = Utils.getFluidStackFromItemStack(item); if (fluid != null) { Fluid f = fluid.getFluid(); if (f != null) { Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); renderMask(overlay, f.getIcon(), type); } } Minecraft.getMinecraft().renderEngine.bindTexture(RenderUtils.MC_ITEM_SHEET); if (type.equals(ItemRenderType.INVENTORY)) renderIcon(canisterIcon, 0); else ItemRenderer.renderItemIn2D(Tessellator.instance, canisterIcon.getMinU(), canisterIcon.getMaxV(), canisterIcon.getMaxU(), canisterIcon.getMinV(), canisterIcon.getIconWidth(), canisterIcon.getIconHeight(), 0.0625F); GL11.glColor4f(1, 1, 1, 1); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.KineticToolItemRender.java
License:GNU General Public License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { IIcon overlayChainsaw = tool.overlayChainsaw; IIcon overlayDigger = tool.overlayDigger; IIcon overlayDrill = tool.overlayDrill; IIcon overlayHoe = tool.overlayHoe;//ww w . j av a2 s. c om IIcon toolIcon = tool.getIconFromDamage(0); GL11.glPushMatrix(); if (type.equals(ItemRenderType.EQUIPPED)) { GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); GL11.glTranslated(-1.0D, -1.0D, 0.0D); } else if (type.equals(ItemRenderType.ENTITY)) { GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D); GL11.glTranslated(-0.5D, -0.9D, 0.0D); if (item.isOnItemFrame()) { GL11.glTranslated(0.1D, 0.4D, 0.0D); GL11.glScaled(0.85D, 0.85D, 0.85D); } } else if (type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) { GL11.glTranslated(1.0D, 1.0D, 0.0D); GL11.glRotated(180.0D, 0.0D, 0.0D, 1.0D); } String lastUsedMode = ""; if (item.stackTagCompound != null && item.stackTagCompound.hasKey("lastUsedMode")) lastUsedMode = item.stackTagCompound.getString("lastUsedMode"); if (lastUsedMode.equals("axe")) { Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); renderMask(overlayChainsaw, overlayChainsaw, type); } if (lastUsedMode.equals("shovel")) { Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); renderMask(overlayDigger, overlayDigger, type); } if (lastUsedMode.equals("pickaxe")) { Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); renderMask(overlayDrill, overlayDrill, type); } if (lastUsedMode.equals("hoe")) { Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); renderMask(overlayHoe, overlayHoe, type); } Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE); if (!type.equals(ItemRenderType.INVENTORY)) ItemRenderer.renderItemIn2D(Tessellator.instance, toolIcon.getMinU(), toolIcon.getMaxV(), toolIcon.getMaxU(), toolIcon.getMinV(), toolIcon.getIconWidth(), toolIcon.getIconHeight(), 0.0625F); else renderIcon(toolIcon, 0.0D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:buildcraftAdditions.client.render.tileentities.RendererBackPackStand.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float fl) { if (entity == null || !(entity instanceof TileBackpackStand)) return;// w ww . j a v a2 s . c om int orientation = entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord); int angle; switch (orientation) { case 2: angle = 0; break; case 3: angle = 180; break; case 4: angle = 90; break; case 5: angle = -90; break; default: angle = 0; } GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 2.4, z + 0.5); GL11.glRotated(angle, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); GL11.glScaled(10, 10, 10); ModelBackpackStand.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.01f); GL11.glPopMatrix(); TileBackpackStand stand = (TileBackpackStand) entity; if (stand.inventory.getStackInSlot(0) == null) return; GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 1.4, z + 0.5); GL11.glRotated(angle, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); BackPackModel.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.1F); GL11.glPopMatrix(); ItemStack bStack = stand.inventory.getStackInSlot(0); ItemKineticBackpack backpack = (ItemKineticBackpack) bStack.getItem(); if (backpack.getInstalledCapsule(bStack, 0) != 0) { GL11.glPushMatrix(); switch (orientation) { case 2: GL11.glTranslated(x + 0.7, y + 3.15, z + 0.07); break; case 3: GL11.glTranslated(x + 0.3, y + 3.15, z + 0.93); break; case 4: GL11.glTranslated(x + 0.07, y + 3.15, z + 0.3); break; case 5: GL11.glTranslated(x + 0.92, y + 3.15, z + 0.71); break; } GL11.glScaled(2, 2, 2); GL11.glRotated(angle, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 0)); GL11.glPopMatrix(); } if (backpack.getInstalledCapsule(bStack, 1) != 0) { GL11.glPushMatrix(); switch (orientation) { case 2: GL11.glTranslated(x + 0.3, y + 3.15, z + 0.07); break; case 3: GL11.glTranslated(x + 0.7, y + 3.15, z + 0.93); break; case 4: GL11.glTranslated(x + 0.08, y + 3.15, z + 0.69); break; case 5: GL11.glTranslated(x + 0.93, y + 3.15, z + 0.3); break; } GL11.glRotated(angle, 0, 1, 0); GL11.glScaled(2, 2, 2); GL11.glRotated(180, 1, 0, 0); ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 1)); GL11.glPopMatrix(); } if (backpack.getInstalledCapsule(bStack, 2) != 0) { GL11.glPushMatrix(); switch (orientation) { case 2: GL11.glTranslated(x + 0.7, y + 2.85, z + 0.07); break; case 3: GL11.glTranslated(x + 0.3, y + 2.85, z + 0.93); break; case 4: GL11.glTranslated(x + 0.07, y + 2.85, z + 0.3); break; case 5: GL11.glTranslated(x + 0.92, y + 2.85, z + 0.71); break; } GL11.glScaled(2, 2, 2); GL11.glRotated(angle, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 2)); GL11.glPopMatrix(); } if (backpack.getInstalledCapsule(bStack, 3) != 0) { GL11.glPushMatrix(); switch (orientation) { case 2: GL11.glTranslated(x + 0.3, y + 2.85, z + 0.07); break; case 3: GL11.glTranslated(x + 0.7, y + 2.85, z + 0.93); break; case 4: GL11.glTranslated(x + 0.07, y + 2.85, z + 0.71); break; case 5: GL11.glTranslated(x + 0.92, y + 2.85, z + 0.31); break; } GL11.glScaled(2, 2, 2); GL11.glRotated(angle, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); ModelCapsule.INSTANCE.render(null, 0, 0, 0, 0, 0, 0.05F, backpack.getInstalledCapsule(bStack, 3)); GL11.glPopMatrix(); } }
From source file:cn.academy.ability.electro.client.render.skill.SRSmallCharge.java
License:Open Source License
@Override public void draw() { GL11.glDisable(GL11.GL_CULL_FACE);//from w w w . j a v a 2 s .co m GL11.glDepthMask(false); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4d(1, 1, 1, 0.7); GL11.glTranslated(0, 0.9, 0.2); GL11.glRotated(120, 1, 0, 0); GL11.glScaled(0.5, 0.5, 0.5); //RenderUtils.drawCube(1, 1, 2); for (ArcObject arc : arcs) { arc.draw(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.ability.teleport.client.render.entity.MarkRender.java
License:Open Source License
@Override public void doRender(Entity ent, double x, double y, double z, float var8, float var9) { EntityTPMarking mark = (EntityTPMarking) ent; int texID = (int) ((mark.ticksExisted / 2.5) % tex.length); GL11.glEnable(GL11.GL_BLEND);//from w w w .ja v a 2 s .c o m GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glColor4d(1, 1, 1, 1); GL11.glPushMatrix(); { GL11.glTranslated(x, y, z); GL11.glRotated(-mark.rotationYaw, 0, 1, 0); GL11.glScaled(-1, -1, 1); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); Tessellator.instance.setBrightness(15728880); RenderUtils.loadTexture(tex[texID]); model.draw(); } GL11.glPopMatrix(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.core.client.gui.GuiMainScreen.java
License:Open Source License
@Override public void draw(ScaledResolution sr) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; AbilityData data = AbilityDataMain.getData(player); double w = sr.getScaledWidth_double(), h = sr.getScaledHeight_double(); double size = 80.0, x = w - 80, y = h - 65; boolean active = EventHandlerClient.isSkillEnabled(); long time = Minecraft.getSystemTime(); GL11.glEnable(GL11.GL_BLEND);/*from w w w . ja v a 2 s .c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glPushMatrix(); { //Logo rendering double scale = .25; double mAlpha = active ? 0.8 : 0.4; HudUtils.setTextureResolution(256, 256); GL11.glTranslated(w - 80, h - 70, 0); GL11.glScaled(scale, scale, 1); GL11.glColor4d(1, 1, 1, mAlpha); logoBack.draw(); GL11.glColor4d(1, 1, 1, (mAlpha * 1.25) * (0.7 + Math.sin(time / 900D) * 0.3)); logoRays.draw(); GL11.glColor4d(1, 1, 1, mAlpha); logoBack.draw(); logoFrame.draw(); RenderUtils.loadTexture(data.getCategory().getLogo()); HudUtils.drawRect(63, 63, 129, 129); logoGeom.getTransform().setRoll(time / 1000D); logoGeom.draw(); } GL11.glPopMatrix(); RenderUtils.bindIdentity(); //CPBar rendering if (active) { lastActiveTime = time; } else { lastInactiveTime = time; } double mAlpha = active ? Math.min((time - lastInactiveTime) / 300D, 1.0) : Math.max((300 + lastActiveTime - time) / 300D, 0.0); if (mAlpha > 0) { //Cooldown drawCooldownBars(data, mAlpha, w, h); GL11.glColor4d(1, 1, 1, mAlpha * 0.6); RenderUtils.loadTexture(ACClientProps.TEX_HUD_BAR); HudUtils.setTextureResolution(512, 200); double scale = .4; GL11.glTranslated(w - 193, 17, 0); GL11.glScaled(scale, scale, 0); //Back HudUtils.drawRect(0, 0, 0, 73, 455, 127, 455, 127); //CPBar double prog = data.getCurrentCP() / data.getMaxCP(); int[] cs = data.getCategory().getColorStyle(); RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (mAlpha * 255)); HudUtils.drawRect(439 - 436 * prog, 3, 439 - 436 * prog, 4, 436 * prog, 28, 436 * prog, 28); //CPBar glow double alpha = Math.max(0, (prog - 0.6) / 0.4); GL11.glColor4d(1, 1, 1, alpha * mAlpha); HudUtils.drawRect(3, 3, 3, 42, 436, 28, 436, 28); //Chip HudUtils.drawRect(269, 46, 478, 40, 26, 26, 26, 26); alpha = 0.5 + 0.5 * Math.sin(Minecraft.getSystemTime() / 500D); RenderUtils.bindColor(cs[0], cs[1], cs[2], (int) (alpha * mAlpha * 255)); //Chip glow light HudUtils.drawRect(266, 45, 474, 5, 32, 32, 32, 32); //Level GL11.glColor4d(1, 1, 1, mAlpha * .6); ACClientProps.FONT_YAHEI_32.drawAdjusted(data.getLevel().getDisplayName(), 184, 58, 20, 69); //Numeric CP String str = String.format("%.0f/%.0f", data.getCurrentCP(), data.getMaxCP()); font.drawAdjusted(str, 316, 87, 22, Align.CENTER, 167); } } GL11.glPopMatrix(); RenderUtils.bindIdentity(); GL11.glDisable(GL11.GL_BLEND); }
From source file:cn.academy.core.client.render.ray.RendererRayCylinder.java
License:GNU General Public License
@Override protected void draw(Entity entity, double len) { if (RenderUtils.isInShadowPass()) return;//from w ww . j a v a 2 s . c o m GL11.glEnable(GL11.GL_BLEND); GL11.glPushMatrix(); IRay ray = (IRay) entity; //HACK: Store the previous alpha double oldA = color.a; color.a *= ray.getAlpha(); double width = this.width * ray.getWidth(); color.bind(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); double offset = width * (1 - headFix); GL11.glTranslated(offset, 0, 0); GL11.glScaled(width * headFix, width, width); head.draw(shader); GL11.glPopMatrix(); //Draw the cylinder GL11.glPushMatrix(); GL11.glTranslated(width, 0, 0); GL11.glScaled(len - width, width, width); cylinder.draw(shader); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(len + width - offset, 0, 0); GL11.glScaled(-width * headFix, width, -width); head.draw(shader); GL11.glPopMatrix(); GL11.glPopMatrix(); color.a = oldA; GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4d(1, 1, 1, 1); }