List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:de.sanandrew.mods.turretmod.client.render.item.ItemRendererTile.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { GL11.glPushMatrix();/*from www. j a v a 2s.co m*/ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(-1.0F, 0.0F, -0.0F); } else { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } GL11.glEnable(GL11.GL_ALPHA_TEST); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.tile, 0.0D, 0.0D, 0.0D, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partTicks) { Minecraft mc = Minecraft.getMinecraft(); if (this.tooltipFR == null) { this.tooltipFR = new FontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, true);// w ww. jav a 2s . c om if (mc.gameSettings.language != null) { this.tooltipFR.setBidiFlag(mc.getLanguageManager().isCurrentLanguageBidirectional()); } } TileEntityItemTransmitter te = ((TileEntityItemTransmitter) tile); GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); if (te.renderPass == 0) { GL11.glPushMatrix(); this.bindTexture(Textures.TILE_ITEM_TRANSMITTER.getResource()); this.modelBlock.render(0.0625F); this.bindTexture(Textures.TILE_ITEM_TRANSMITTER_GLOW.getResource()); float prevBrightX = OpenGlHelper.lastBrightnessX; float prevBrightY = OpenGlHelper.lastBrightnessY; int bright = 0xF0; int brightX = bright % 65536; int brightY = bright / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F); this.modelBlock.render(0.0625F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY); GL11.glPopMatrix(); } // else { // MovingObjectPosition objPos = mc.objectMouseOver; // // float prevBrightX = OpenGlHelper.lastBrightnessX; // float prevBrightY = OpenGlHelper.lastBrightnessY; // int bright = 0xF0; // int brightX = bright % 65536; // int brightY = bright / 65536; // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F); // // if( objPos.typeOfHit == MovingObjectType.BLOCK && mc.theWorld.getTileEntity(objPos.blockX, objPos.blockY, objPos.blockZ) == te // && mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() == TmrItems.turretCtrlUnit ) // { // GL11.glPushMatrix(); // setupTooltipRenderer(mc, te, partTicks); // // if( te.scaleTooltip < 1.0F ) { // te.scaleTooltip += 0.2F; // } else { // te.scaleTooltip = 1.01F; // } // renderTooltipBg(Tessellator.instance, te.scaleTooltip); // // if( te.scaleTooltip >= 1.0F ) { // if( te.lengthTooltipRod < 1.0F ) { // te.lengthTooltipRod += 0.1F; // } else { // te.lengthTooltipRod = 1.01F; // } // renderTooltipRod(Tessellator.instance, te.lengthTooltipRod); // } // finishTooltipRenderer(); // // if( te.scaleTooltip >= 1.0F ) { // renderTooltipText(this.tooltipFR, te, 0xFFFFFF, te.lengthTooltipRod); // } // // GL11.glPopMatrix(); // } else { // if( te.timestampLastRendered < mc.theWorld.getTotalWorldTime() - 2 ) { // te.scaleTooltip = 0.0F; // te.lengthTooltipRod = 0.0F; // } else if( te.scaleTooltip > 0.0F ) { // GL11.glPushMatrix(); // setupTooltipRenderer(mc, te, partTicks); // if( te.lengthTooltipRod > 0.0F ) { // te.lengthTooltipRod -= 0.1F; // renderTooltipRod(Tessellator.instance, te.lengthTooltipRod); // } else { // te.lengthTooltipRod = -0.01F; // } // // if( te.lengthTooltipRod <= 0.0F ) { // if( te.scaleTooltip > 0.0F ) { // te.scaleTooltip -= 0.2F; // } else { // te.scaleTooltip = -0.01F; // } // } // renderTooltipBg(Tessellator.instance, te.scaleTooltip); // // finishTooltipRenderer(); // // if( te.lengthTooltipRod > 0.0F ) { // renderTooltipText(this.tooltipFR, te, 0xFFFFFF, te.lengthTooltipRod); // } // GL11.glPopMatrix(); // } // } // // OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY); // // te.timestampLastRendered = mc.theWorld.getTotalWorldTime(); // } GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java
License:Creative Commons License
private static void renderTooltipText(FontRenderer fontRenderer, TileEntityItemTransmitter te, int color, float alpha) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, 0.0F, 0.0F); GL11.glScalef(0.01F, 0.01F, 0.01F);/* w w w .ja v a2 s. co m*/ GL11.glTranslatef(8.0F, 8.0F, -1.0F); int max = 0xE0; int alphaInt = Math.min(Math.max(0x04, MathHelper.ceiling_float_int(max * alpha)), max); ItemStack stack = te.getRequestItem(); Turret turret = te.getRequestingTurret(); String s; s = SAPUtils.translatePostFormat("Requesting: %s", te.getRequest().name()); fontRenderer.drawString(s, 0, te.getRequest() == Request.NONE ? 18 : 0, color | (alphaInt << 24)); if (te.getRequest() != Request.NONE && turret != null && stack != null) { s = SAPUtils.translatePostFormat("Item: %s x%d", stack.getDisplayName(), stack.stackSize); fontRenderer.drawString(s, 0, 9, color | (alphaInt << 24)); s = SAPUtils.translatePostFormat("Turret: %s", turret.getTurretName()); fontRenderer.drawString(s, 0, 18, color | (alphaInt << 24)); s = SAPUtils.translatePostFormat(" @ x:%.0f y:%.0f z:%.0f", turret.getEntity().posX, turret.getEntity().posY, turret.getEntity().posZ); fontRenderer.drawString(s, 0, 27, color | (alphaInt << 24)); s = SAPUtils.translatePostFormat("Expiration time: %d", te.requestTimeout); fontRenderer.drawString(s, 0, 36, color | (alphaInt << 24)); } }
From source file:de.sanandrew.mods.varietychests.client.ItemRendererCustomChest.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix();/* w w w .ja v a 2 s . c o m*/ GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(-1.0F, 0.0F, -0.0F); } else { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } this.chest.chestType = ChestType.getTypeFromItemStack(item); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.varietychests.client.renderer.ItemRendererCustomChest.java
License:Creative Commons License
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { GL11.glPushMatrix();//from w ww.j a v a 2 s .c om GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(-1.0F, 0.0F, -0.0F); } else { GL11.glTranslatef(-0.5F, -0.5F, -0.5F); } this.chest.blockType = Block.getBlockFromItem(stack.getItem()); this.chest.chestType = ChestType.getType(stack); GL11.glEnable(GL11.GL_ALPHA_TEST); TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.varietychests.client.renderer.TileEntityCustomChestRenderer.java
License:Creative Commons License
public void renderChestAt(TileEntityCustomChest chest, double x, double y, double z, float partTicks, int pass) { int meta;/* w w w . j a va 2 s .com*/ if (!chest.hasWorldObj()) { meta = 0; } else { Block block = chest.getBlockType(); meta = chest.getBlockMetadata(); if (block instanceof BlockCustomChest && meta == 0) { try { ((BlockCustomChest) block).func_149954_e(chest.getWorldObj(), chest.xCoord, chest.yCoord, chest.zCoord); } catch (ClassCastException e) { FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", chest.xCoord, chest.yCoord, chest.zCoord); } meta = chest.getBlockMetadata(); } chest.checkForAdjacentChests(); } if (chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) { ModelChest modelchest; if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null) { modelchest = this.modelSingleChest; if (pass == 0) { this.bindTexture(chest.getChestType().textureSng); } else { if (chest.blockType == VarietyChests.customGlowingChest) { this.bindTexture(Textures.CHEST_GLOWMAP_SNG); } else if (chest.blockType == VarietyChests.customTrapChest) { this.bindTexture(Textures.CHEST_TRAPMAP_SNG); } } } else { modelchest = this.modelDoubleChest; if (pass == 0) { this.bindTexture(chest.getChestType().textureDbl); } else { if (chest.blockType == VarietyChests.customGlowingChest) { this.bindTexture(Textures.CHEST_GLOWMAP_DBL); } else if (chest.blockType == VarietyChests.customTrapChest) { this.bindTexture(Textures.CHEST_TRAPMAP_DBL); } } } GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; if (meta == 2) { short1 = 180; } if (meta == 3) { short1 = 0; } if (meta == 4) { short1 = 90; } if (meta == 5) { short1 = -90; } if (meta == 2 && chest.adjacentChestXPos != null) { GL11.glTranslatef(1.0F, 0.0F, 0.0F); } if (meta == 5 && chest.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 = chest.prevLidAngle + (chest.lidAngle - chest.prevLidAngle) * partTicks; float f2; if (chest.adjacentChestZNeg != null) { f2 = chest.adjacentChestZNeg.prevLidAngle + (chest.adjacentChestZNeg.lidAngle - chest.adjacentChestZNeg.prevLidAngle) * partTicks; if (f2 > f1) { f1 = f2; } } if (chest.adjacentChestXNeg != null) { f2 = chest.adjacentChestXNeg.prevLidAngle + (chest.adjacentChestXNeg.lidAngle - chest.adjacentChestXNeg.prevLidAngle) * partTicks; if (f2 > f1) { f1 = f2; } } f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); if (pass == 1) { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); modelchest.renderAll(); GL11.glDisable(GL11.GL_BLEND); } else { modelchest.renderAll(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } }
From source file:de.sanandrew.mods.varietychests.client.TileEntityCustomChestRenderer.java
License:Creative Commons License
public void renderTileEntityAt(TileEntityCustomChest chest, double x, double y, double z, float partTicks) { int meta;/* w w w . j a v a2s. com*/ if (!chest.hasWorldObj()) { meta = 0; } else { Block block = chest.getBlockType(); meta = chest.getBlockMetadata(); if (block instanceof BlockCustomChest && meta == 0) { try { ((BlockCustomChest) block).func_149954_e(chest.getWorldObj(), chest.xCoord, chest.yCoord, chest.zCoord); } catch (ClassCastException e) { FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", chest.xCoord, chest.yCoord, chest.zCoord); } meta = chest.getBlockMetadata(); } chest.checkForAdjacentChests(); } if (chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) { ModelChest modelchest; if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null) { modelchest = this.modelSingleChest; this.bindTexture(chest.getChestType().textureSng); } else { modelchest = this.modelDoubleChest; this.bindTexture(chest.getChestType().textureDbl); } GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; if (meta == 2) { short1 = 180; } if (meta == 3) { short1 = 0; } if (meta == 4) { short1 = 90; } if (meta == 5) { short1 = -90; } if (meta == 2 && chest.adjacentChestXPos != null) { GL11.glTranslatef(1.0F, 0.0F, 0.0F); } if (meta == 5 && chest.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 = chest.prevLidAngle + (chest.lidAngle - chest.prevLidAngle) * partTicks; float f2; if (chest.adjacentChestZNeg != null) { f2 = chest.adjacentChestZNeg.prevLidAngle + (chest.adjacentChestZNeg.lidAngle - chest.adjacentChestZNeg.prevLidAngle) * partTicks; if (f2 > f1) { f1 = f2; } } if (chest.adjacentChestXNeg != null) { f2 = chest.adjacentChestXNeg.prevLidAngle + (chest.adjacentChestXNeg.lidAngle - chest.adjacentChestXNeg.prevLidAngle) * partTicks; 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:dynamicswordskills.client.RenderEntitySwordBeam.java
License:Open Source License
public void renderBeam(Entity entity, double x, double y, double z, float yaw, float partialTick) { GL11.glPushMatrix();/* ww w . ja va 2s . com*/ GL11.glTranslated(x, y, z); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(1.5F, 1.25F, 1.5F); bindTexture(texture); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer renderer = tessellator.getWorldRenderer(); GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); renderer.startDrawingQuads(); renderer.setNormal(0.0F, 1.0F, 0.0F); renderer.addVertexWithUV(-0.5D, -0.25D, 0.0D, 0, 1); renderer.addVertexWithUV(0.5D, -0.25D, 0.0D, 1, 1); renderer.addVertexWithUV(0.5D, 0.75D, 0.0D, 1, 0); renderer.addVertexWithUV(-0.5D, 0.75D, 0.0D, 0, 0); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:edu.csun.ecs.cs.multitouchj.ui.control.FramedControl.java
License:Apache License
public void render() { // render with no texture Texture texture = getTexture();/* www .j av a 2 s .c o m*/ setTexture((Texture) null); GL11.glPushMatrix(); GL11.glLoadIdentity(); super.render(); GL11.glPopMatrix(); setTexture(texture); // rendering texture if ((!isVisible()) || (texture == null)) { return; } Size controlSize = getSize(); Size imageSize = texture.getImage().getSize(); float margin = getMargin(); if ((margin >= controlSize.getWidth()) || (margin >= controlSize.getHeight())) { margin = 0.0f; } Color color = getColor(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(((float) color.getRed() / 255.0f), ((float) color.getGreen() / 255.0f), ((float) color.getBlue() / 255.0f), getOpacity()); Point position = getOpenGlPosition(); float halfWidth = (controlSize.getWidth() / 2.0f); float halfHeight = (controlSize.getHeight() / 2.0f); GL11.glTranslatef(position.getX(), position.getY(), 0.0f); float rotation = OpenGlUtility.getOpenGlRotation(getRotation()); GL11.glRotatef(rotation, 0.0f, 0.0f, 1.0f); // render texture GL11.glEnable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); GL11.glBindTexture(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT, texture.getId().intValue()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(((-1 * halfWidth) + margin), ((-1 * halfHeight) + margin), 0.0f); GL11.glTexCoord2f(imageSize.getWidth(), 0.0f); GL11.glVertex3f((halfWidth - margin), ((-1 * halfHeight) + margin), 0.0f); GL11.glTexCoord2f(imageSize.getWidth(), imageSize.getHeight()); GL11.glVertex3f((halfWidth - margin), (halfHeight - margin), 0.0f); GL11.glTexCoord2f(0.0f, imageSize.getHeight()); GL11.glVertex3f(((-1 * halfWidth) + margin), (halfHeight - margin), 0.0f); GL11.glEnd(); }
From source file:edu.csun.ecs.cs.multitouchj.ui.control.TexturedControl.java
License:Apache License
public void render() { if (!isVisible()) { return;// ww w . ja v a 2 s. c o m } Size controlSize = getSize(); Size imageSize = null; if (texture != null) { imageSize = texture.getImage().getSize(); } Color color = getColor(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(((float) color.getRed() / 255.0f), ((float) color.getGreen() / 255.0f), ((float) color.getBlue() / 255.0f), getOpacity()); Point position = getOpenGlPosition(); float halfWidth = (controlSize.getWidth() / 2.0f); float halfHeight = (controlSize.getHeight() / 2.0f); GL11.glTranslatef(position.getX(), position.getY(), 0.0f); float rotation = OpenGlUtility.getOpenGlRotation(getRotation()); GL11.glRotatef(rotation, 0.0f, 0.0f, 1.0f); if (texture != null) { GL11.glEnable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); GL11.glBindTexture(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT, texture.getId().intValue()); } else { GL11.glDisable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); } // bl -> br -> tr -> tl GL11.glBegin(GL11.GL_QUADS); if (texture != null) { GL11.glTexCoord2f(0.0f, 0.0f); } GL11.glVertex3f((-1 * halfWidth), (-1 * halfHeight), 0.0f); if (texture != null) { GL11.glTexCoord2f(imageSize.getWidth(), 0.0f); } GL11.glVertex3f(halfWidth, (-1 * halfHeight), 0.0f); if (texture != null) { GL11.glTexCoord2f(imageSize.getWidth(), imageSize.getHeight()); } GL11.glVertex3f(halfWidth, halfHeight, 0.0f); if (texture != null) { GL11.glTexCoord2f(0.0f, imageSize.getHeight()); } GL11.glVertex3f((-1 * halfWidth), halfHeight, 0.0f); GL11.glEnd(); }