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.theslarfab.tmnmod.client.renderer.tileentity.TileEntityEndWoodChestRenderer.java
License:Open Source License
public void renderTileEntityAt(TileEntityEndWoodChest p_147502_1_, double p_147502_2_, double p_147502_4_, double p_147502_6_, float p_147502_8_) { int i;/*from w w w . j a v a 2 s . c o m*/ if (!p_147502_1_.hasWorldObj()) { i = 0; } else { Block block = p_147502_1_.getBlockType(); i = p_147502_1_.getBlockMetadata(); if (block instanceof BlockEndWoodChest && i == 0) { try { ((BlockEndWoodChest) block).func_149954_e(p_147502_1_.getWorldObj(), p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord); } catch (ClassCastException e) { FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", p_147502_1_.xCoord, p_147502_1_.yCoord, p_147502_1_.zCoord); } i = p_147502_1_.getBlockMetadata(); } p_147502_1_.checkForAdjacentChests(); } if (p_147502_1_.adjacentChestZNeg == null && p_147502_1_.adjacentChestXNeg == null) { ModelChest modelchest; if (p_147502_1_.adjacentChestXPos == null && p_147502_1_.adjacentChestZPos == null) { modelchest = this.singleChest; this.bindTexture(chestTexture); } else { modelchest = this.doubleChest; this.bindTexture(doubleChestTexture); } GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) p_147502_2_, (float) p_147502_4_ + 1.0F, (float) p_147502_6_ + 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; } if (i == 2 && p_147502_1_.adjacentChestXPos != null) { GL11.glTranslatef(1.0F, 0.0F, 0.0F); } if (i == 5 && p_147502_1_.adjacentChestZPos != null) { GL11.glTranslatef(0.0F, 0.0F, -1.0F); } GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = p_147502_1_.prevLidAngle + (p_147502_1_.lidAngle - p_147502_1_.prevLidAngle) * p_147502_8_; float f2; if (p_147502_1_.adjacentChestZNeg != null) { f2 = p_147502_1_.adjacentChestZNeg.prevLidAngle + (p_147502_1_.adjacentChestZNeg.lidAngle - p_147502_1_.adjacentChestZNeg.prevLidAngle) * p_147502_8_; if (f2 > f1) { f1 = f2; } } if (p_147502_1_.adjacentChestXNeg != null) { f2 = p_147502_1_.adjacentChestXNeg.prevLidAngle + (p_147502_1_.adjacentChestXNeg.lidAngle - p_147502_1_.adjacentChestXNeg.prevLidAngle) * p_147502_8_; if (f2 > f1) { f1 = f2; } } 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:com.xlogisticzz.learningModding.client.RenderSpaceship.java
License:LGPL
public void renderSpaceship(EntitySpaceship spaceship, double x, double y, double z, float yaw, float partialTickTime) { GL11.glPushMatrix();/*from w w w .j a v a 2 s.c o m*/ GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F); GL11.glScalef(-1.0F, -1.0F, 1.0F); bindEntityTexture(spaceship); this.model.render(spaceship, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private void render(final TileRefinery tile, final double x, final double y, final double z) { float anim = 0; int angle = 0; ModelRenderer theMagnet = this.magnet[0]; if (tile != null) { anim = tile.getAnimationStage(); angle = 0;// w w w. ja v a2 s . c om switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) { case 2: angle = 90; break; case 3: angle = 270; break; case 4: angle = 180; break; case 5: angle = 0; break; } if (tile.animationSpeed <= 1) theMagnet = this.magnet[0]; else if (tile.animationSpeed <= 2.5) theMagnet = this.magnet[1]; else if (tile.animationSpeed <= 4.5) theMagnet = this.magnet[2]; else theMagnet = this.magnet[3]; } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glRotatef(angle, 0, 1, 0); bindTexture(TEXTURE); GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-4F * pixel, 0, -4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, 4F * pixel); GL11.glTranslatef(-4F * pixel, 0, 4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, -4F * pixel); GL11.glTranslatef(4F * pixel, 0, 0); this.tank.render(pixel); GL11.glTranslatef(-4F * pixel, 0, 0); GL11.glPopMatrix(); float trans1, trans2; if (anim <= 100) { trans1 = 12F * pixel * anim / 100F; trans2 = 0; } else if (anim <= 200) { trans1 = 12F * pixel - 12F * pixel * (anim - 100F) / 100F; trans2 = 12F * pixel * (anim - 100F) / 100F; } else { trans1 = 12F * pixel * (anim - 200F) / 100F; trans2 = 12F * pixel - 12F * pixel * (anim - 200F) / 100F; } renderMagnet(trans1, theMagnet, 0); renderMagnet(trans2, theMagnet, 12 * pixel); if (tile != null) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glScalef(0.5F, 1, 0.5F); renderFluid(tile.src[0], 0, 0, 0, tile.buf); renderFluid(tile.src[1], 0, 0, 1, tile.buf); renderFluid(tile.res, 1, 0, 0.5F, tile.buf); GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:com.yogpc.qp.client.RenderRefinery.java
License:Open Source License
private static void renderMagnet(final float trans, final ModelRenderer magnet, final float offset) { GL11.glPushMatrix();//from w ww . j a v a 2s . c o m GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans - 0.5F, offset - 0.5F); magnet.render(pixel); GL11.glPopMatrix(); }
From source file:common.xandayn.personalrecipes.client.gui.recipe.add.FuelRecipeGUIComponent.java
License:Open Source License
@Override public void renderForeground(int mouseX, int mouseY) { if (!slot.isDialogOpen()) { super.renderForeground(mouseX, mouseY); Rendering.drawString("Burn Time", guiLeft + 11, guiTop + 38, 0xFFFFFFFF); GL11.glPushMatrix();//from w w w . j a v a 2s.co m GL11.glScalef(0.9f, 0.9f, 0.9f); Rendering.drawString("200 Burn", guiLeft + 89, guiTop + 54, 0xFFFFFFFF); Rendering.drawString("Time is 1", guiLeft + 89, guiTop + 64, 0xFFFFFFFF); Rendering.drawString("item smelted.", guiLeft + 89, guiTop + 74, 0xFFFFFFFF); GL11.glPopMatrix(); } else slot.renderForeground(mouseX, mouseY); }
From source file:common.xandayn.personalrecipes.client.gui.recipe.remove.FuelRecipeRemoveGUIComponent.java
License:Open Source License
@Override public void renderForeground(int mouseX, int mouseY) { super.renderForeground(mouseX, mouseY); Rendering.drawString("Burn Time", guiLeft + 11, guiTop + 38, 0xFFFFFFFF); GL11.glPushMatrix();/*from w w w . j a va2 s. co m*/ GL11.glScalef(0.9f, 0.9f, 0.9f); Rendering.drawString("200 Burn", guiLeft + 89, guiTop + 54, 0xFFFFFFFF); Rendering.drawString("Time is 1", guiLeft + 89, guiTop + 64, 0xFFFFFFFF); Rendering.drawString("item smelted.", guiLeft + 89, guiTop + 74, 0xFFFFFFFF); GL11.glPopMatrix(); }
From source file:cpw.mods.fml.client.config.GuiUnicodeGlyphButton.java
License:Open Source License
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int k = this.getHoverState(this.field_146123_n); GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel); this.mouseDragged(mc, mouseX, mouseY); int color = 14737632; if (packedFGColour != 0) { color = packedFGColour;/*from w w w. j a v a 2 s. co m*/ } else if (!this.enabled) { color = 10526880; } else if (this.field_146123_n) { color = 16777120; } String buttonText = this.displayString; int glyphWidth = (int) (mc.fontRenderer.getStringWidth(glyph) * glyphScale); int strWidth = mc.fontRenderer.getStringWidth(buttonText); int elipsisWidth = mc.fontRenderer.getStringWidth("..."); int totalWidth = strWidth + glyphWidth; if (totalWidth > width - 6 && totalWidth > elipsisWidth) buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - elipsisWidth).trim() + "..."; strWidth = mc.fontRenderer.getStringWidth(buttonText); totalWidth = glyphWidth + strWidth; GL11.glPushMatrix(); GL11.glScalef(glyphScale, glyphScale, 1.0F); this.drawCenteredString(mc.fontRenderer, glyph, (int) (((this.xPosition + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2), (int) (((this.yPosition + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), color); GL11.glPopMatrix(); this.drawCenteredString(mc.fontRenderer, buttonText, (int) (this.xPosition + (this.width / 2) + (glyphWidth / glyphScale)), this.yPosition + (this.height - 8) / 2, color); } }
From source file:dan200.billund.client.BillundProxyClient.java
public static void renderBrick(ItemStack brick, boolean scale, boolean center) { Tessellator tessellator = Tessellator.instance; int brightness = 15; int colour = ItemBrick.getColour(brick); int width = ItemBrick.getWidth(brick); int height = ItemBrick.getHeight(brick); int depth = ItemBrick.getDepth(brick); // Setup GL11.glPushMatrix();// www . ja v a 2s. c o m if (scale) { float scaleValue = ((float) TileEntityBillund.LAYERS_PER_BLOCK) / Math.max(2.0f, (float) Math.max(width, depth) - 0.5f); GL11.glScalef(scaleValue, scaleValue, scaleValue); } if (center) { GL11.glTranslatef(-0.5f * ((float) width / (float) TileEntityBillund.ROWS_PER_BLOCK), -0.5f * ((float) height / (float) TileEntityBillund.LAYERS_PER_BLOCK), -0.5f * ((float) depth / (float) TileEntityBillund.ROWS_PER_BLOCK)); } GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(mc.getTextureManager().getResourceLocation(0)); // bind the terrain texture tessellator.startDrawingQuads(); tessellator.setNormal(0.0f, -1.0f, 0.0f); renderBrick(null, brightness, colour, 0, 0, 0, width, height, depth); tessellator.draw(); // Teardown GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:dan200.billund.client.RenderAirDrop.java
private void doRenderFallingSand(EntityAirDrop entity, double x, double y, double z, float f, float f2) { World world = entity.getWorld();//from w w w .j a v a 2 s .com Block block = Block.blocksList[entity.blockID]; if (world.getBlockId(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY), MathHelper.floor_double(entity.posZ)) != entity.blockID) { GL11.glPushMatrix(); GL11.glTranslatef((float) x - 0.5f, (float) y - 0.5f, (float) z - 0.5f); this.bindEntityTexture(entity); GL11.glDisable(GL11.GL_LIGHTING); if (block != null) { ChestItemRenderHelper.instance.renderChest(block, 0, 0.0f); if (!entity.deployed) { GL11.glRotatef(180.0f, 0.0f, 0.0f, 1.0f); GL11.glTranslatef(-0.5f, -0.5f, 0.5f); GL11.glScalef(1.2f, 1.2f, 1.2f); Minecraft mc = Minecraft.getMinecraft(); mc.getTextureManager().bindTexture(chuteTexture); m_model.render(0.0625f); } } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } }
From source file:de.mineformers.robots.client.gui.util.render.ModelDrawingHelper.java
License:LGPL
public void render(int par0, int par1, int par2) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix();// w w w . j a va 2 s . c o m GL11.glTranslatef((float) par0, (float) par1, 50.0F); GL11.glScalef((float) (-par2), (float) par2, (float) par2); GL11.glRotatef(180F, 0, 1, 0); /*current = System.currentTimeMillis(); if(current - last >= 0) { last = current; rotation += 0.1F; }*/ rotation += 0.3F; GL11.glRotatef(rotation, 0, 1, 0); RenderHelper.bindTexture(texture); model.justRender(false); if (tile.getStackInSlot(0) != null) { Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); GL11.glTranslatef(0, 0.35F, -0.1F); GL11.glRotatef(180, 1, 0, 0); GL11.glScalef(0.5F, 0.5F, 1F); Icon icon = ModItems.module.getIcon(tile.getStackInSlot(0), 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; ItemStack itemstack = tile.getStackInSlot(0); 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); 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(); } GL11.glPopMatrix(); net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); }