List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:vazkii.botania.client.render.tile.RenderTileSpreader.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) { TileSpreader spreader = (TileSpreader) tileentity; GL11.glPushMatrix();// w w w .j av a2 s .c om GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glRotatef(spreader.rotationX + 90F, 0F, 1F, 0F); GL11.glTranslatef(0F, -1F, 0F); GL11.glRotatef(spreader.rotationY, 1F, 0F, 0F); GL11.glTranslatef(0F, 1F, 0F); Minecraft.getMinecraft().renderEngine .bindTexture(spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture); GL11.glScalef(1F, -1F, -1F); double time = ClientTickHandler.ticksInGame + ticks; if (spreader.isULTRA_SPREADER()) { Color color = Color.getHSBColor((float) ((time * 5 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F); GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F); } model.render(); GL11.glColor3f(1F, 1F, 1F); GL11.glPushMatrix(); double worldTicks = tileentity.getWorldObj() == null ? 0 : time; GL11.glRotatef((float) worldTicks % 360, 0F, 1F, 0F); GL11.glTranslatef(0F, (float) Math.sin(worldTicks / 20.0) * 0.05F, 0F); model.renderCube(); GL11.glPopMatrix(); GL11.glScalef(1F, -1F, -1F); ItemStack stack = spreader.getStackInSlot(0); if (stack != null) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); ILens lens = (ILens) stack.getItem(); GL11.glPushMatrix(); GL11.glTranslatef(-0.4F, -1.4F, -0.4375F); GL11.glScalef(0.8F, 0.8F, 0.8F); RenderLens.render(stack, lens.getLensColor(stack)); GL11.glPopMatrix(); } if (spreader.paddingColor != -1) { Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); Block block = Blocks.carpet; int color = spreader.paddingColor; RenderBlocks render = RenderBlocks.getInstance(); float f = 1F / 16F; GL11.glTranslatef(0F, -f, 0F); render.renderBlockAsItem(block, color, 1F); GL11.glTranslatef(0F, -f * 15, 0F); render.renderBlockAsItem(block, color, 1F); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glPushMatrix(); GL11.glScalef(f * 14F, 1F, 1F); render.renderBlockAsItem(block, color, 1F); GL11.glPopMatrix(); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -f / 2); GL11.glScalef(f * 14F, 1F, f * 15F); render.renderBlockAsItem(block, color, 1F); GL11.glTranslatef(0F, f * 15F, 0F); render.renderBlockAsItem(block, color, 1F); } GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileTinyPotato.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity var1, double d0, double d1, double d2, float var8) { TileTinyPotato potato = (TileTinyPotato) var1; GL11.glPushMatrix();//from w w w.j ava 2 s . c o m GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(d0, d1, d2); Minecraft mc = Minecraft.getMinecraft(); mc.renderEngine.bindTexture(texture); GL11.glTranslatef(0.5F, 1.5F, 0.5F); GL11.glScalef(1F, -1F, -1F); int meta = potato.getWorldObj() == null ? 3 : potato.getBlockMetadata(); float rotY = meta * 90F - 180F; GL11.glRotatef(rotY, 0F, 1F, 0F); float jump = potato.jumpTicks; if (jump > 0) jump += var8; float up = (float) -Math.abs(Math.sin(jump / 10 * Math.PI)) * 0.2F; float rotZ = (float) Math.sin(jump / 10 * Math.PI) * 2; GL11.glTranslatef(0F, up, 0F); GL11.glRotatef(rotZ, 0F, 0F, 1F); model.render(); GL11.glRotatef(-rotZ, 0F, 0F, 1F); GL11.glRotatef(-rotY, 0F, 1F, 0F); GL11.glColor3f(1F, 1F, 1F); GL11.glScalef(1F, -1F, -1F); if (!potato.name.isEmpty()) { GL11.glPushMatrix(); GL11.glTranslatef(0F, -0.6F, 0F); GL11.glRotatef(-RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); float f = 1.6F; float f1 = 0.016666668F * f; GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0F / f1, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = mc.fontRenderer.getStringWidth(potato.name) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1.0D, 0.0D); tessellator.addVertex(-i - 1, 8.0D, 0.0D); tessellator.addVertex(i + 1, 8.0D, 0.0D); tessellator.addVertex(i + 1, -1.0D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); mc.fontRenderer.drawString(potato.name, -mc.fontRenderer.getStringWidth(potato.name) / 2, 0, 0xFFFFFF); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glScalef(1F / -f1, 1F / -f1, 1F / f1); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:vazkii.botania.common.block.tile.TileAltar.java
License:Open Source License
public void renderHUD(Minecraft mc, ScaledResolution res) { int xc = res.getScaledWidth() / 2; int yc = res.getScaledHeight() / 2; float angle = -90; int radius = 24; int amt = 0;/*w w w . j a v a 2 s . c o m*/ for (int i = 0; i < getSizeInventory(); i++) { if (getStackInSlot(i) == null) break; amt++; } if (amt > 0) { float anglePer = 360F / amt; for (RecipePetals recipe : BotaniaAPI.petalRecipes) if (recipe.matches(this)) { GL11.glColor4f(1F, 1F, 1F, 1F); mc.renderEngine.bindTexture(HUDHandler.manaBar); RenderHelper.drawTexturedModalRect(xc + radius + 9, yc - 8, 0, 0, 8, 22, 15); ItemStack stack = recipe.getOutput(); net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting(); RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, xc + radius + 32, yc - 8); RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(Items.wheat_seeds), xc + radius + 16, yc + 6); net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 10, 0xFFFFFF); } net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < amt; i++) { double xPos = xc + Math.cos(angle * Math.PI / 180D) * radius - 8; double yPos = yc + Math.sin(angle * Math.PI / 180D) * radius - 8; GL11.glTranslated(xPos, yPos, 0); RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, getStackInSlot(i), 0, 0); GL11.glTranslated(-xPos, -yPos, 0); angle += anglePer; } net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); } else if (recipeKeepTicks > 0 && hasWater) { String s = StatCollector.translateToLocal("botaniamisc.altarRefill0"); mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 10, 0xFFFFFF); s = StatCollector.translateToLocal("botaniamisc.altarRefill1"); mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 20, 0xFFFFFF); } }
From source file:vazkii.botania.common.item.relic.ItemFlugelEye.java
License:Open Source License
@SideOnly(Side.CLIENT) public void render(ItemStack stack, EntityPlayer player, float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); Tessellator tess = Tessellator.instance; Tessellator.renderingWorldRenderer = false; GL11.glPushMatrix();/* w ww. ja va2s . c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float alpha = ((float) Math.sin((ClientTickHandler.ticksInGame + partialTicks) * 0.2F) * 0.5F + 0.5F) * 0.4F + 0.3F; double posX = player.prevPosX + (player.posX - player.prevPosX) * partialTicks; double posY = player.prevPosY + (player.posY - player.prevPosY) * partialTicks; double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * partialTicks; GL11.glTranslated(posX - RenderManager.renderPosX, posY - RenderManager.renderPosY, posZ - RenderManager.renderPosZ); float base = getRotationBase(stack); int angles = 360; int segAngles = angles / SEGMENTS; float shift = base - segAngles / 2; float u = 1F; float v = 0.25F; float s = 3F; float m = 0.8F; float y = v * s * 2; float y0 = 0; int segmentLookedAt = getSegmentLookedAt(stack, player); for (int seg = 0; seg < SEGMENTS; seg++) { boolean inside = false; float rotationAngle = (seg + 0.5F) * segAngles + shift; if (segmentLookedAt == seg) inside = true; GL11.glPushMatrix(); GL11.glRotatef(rotationAngle, 0F, 1F, 0F); GL11.glTranslatef(s * m, -0.75F, 0F); mc.renderEngine.bindTexture(TextureMap.locationItemsTexture); GL11.glScalef(0.75F, 0.75F, 0.75F); GL11.glTranslatef(0F, 0F, 0.5F); IIcon icon = signs[seg]; GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glColor4f(1F, 1F, 1F, getWarpPoint(stack, seg).isValid() ? 1F : 0.2F); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef(180F, 1F, 0F, 0F); float a = alpha; if (inside) { a += 0.3F; y0 = -y; } if (seg % 2 == 0) GL11.glColor4f(0.6F, 0.6F, 0.6F, a); else GL11.glColor4f(1F, 1F, 1F, a); mc.renderEngine.bindTexture(glowTexture); tess.startDrawingQuads(); for (int i = 0; i < segAngles; i++) { float ang = i + seg * segAngles + shift; double xp = Math.cos(ang * Math.PI / 180F) * s; double zp = Math.sin(ang * Math.PI / 180F) * s; tess.addVertexWithUV(xp * m, y, zp * m, u, v); tess.addVertexWithUV(xp, y0, zp, u, 0); xp = Math.cos((ang + 1) * Math.PI / 180F) * s; zp = Math.sin((ang + 1) * Math.PI / 180F) * s; tess.addVertexWithUV(xp, y0, zp, 0, 0); tess.addVertexWithUV(xp * m, y, zp * m, 0, v); } y0 = 0; tess.draw(); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:vazkii.b_baubles.client.core.handler.LightningHandler.java
License:Open Source License
@SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent event) { Profiler profiler = Minecraft.getMinecraft().mcProfiler; profiler.startSection("botania-particles"); ParticleRenderDispatcher.dispatch(); profiler.startSection("redString"); profiler.endStartSection("lightning"); float frame = event.partialTicks; Entity entity = Minecraft.getMinecraft().thePlayer; TextureManager render = Minecraft.getMinecraft().renderEngine; interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame; interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame; interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame; GL11.glPushMatrix();/*from ww w .j av a2 s. com*/ GL11.glTranslated(-interpPosX, -interpPosY, -interpPosZ); Tessellator tessellator = Tessellator.instance; GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); ParticleRenderDispatcher.lightningCount = 0; render.bindTexture(outsideResource); tessellator.startDrawingQuads(); tessellator.setBrightness(0xF000F0); for (LightningBolt bolt : LightningBolt.boltlist) renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 0, false); tessellator.draw(); render.bindTexture(insideResource); tessellator.startDrawingQuads(); tessellator.setBrightness(0xF000F0); for (LightningBolt bolt : LightningBolt.boltlist) renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 1, true); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glTranslated(interpPosX, interpPosY, interpPosZ); GL11.glPopMatrix(); profiler.endSection(); profiler.endSection(); }
From source file:vazkii.b_baubles.client.core.handler.MultiblockRenderHandler.java
License:Open Source License
private boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, int anchorX, int anchorY, int anchorZ) { ChunkCoordinates pos = comp.getRelativePosition(); int x = pos.posX + anchorX; int y = pos.posY + anchorY; int z = pos.posZ + anchorZ; if (anchor != null && comp.matches(world, x, y, z)) return false; GL11.glPushMatrix();//from w ww. j a v a 2s . com GL11.glTranslated(-RenderManager.renderPosX, -RenderManager.renderPosY, -RenderManager.renderPosZ); GL11.glDisable(GL11.GL_DEPTH_TEST); doRenderComponent(mb, comp, x, y, z, 0.4F); GL11.glPopMatrix(); return true; }
From source file:vazkii.b_baubles.client.core.handler.MultiblockRenderHandler.java
License:Open Source License
public static void renderMultiblockOnPage(Multiblock mb) { GL11.glTranslated(-0.5, -0.5, -0.5); blockAccess.update(null, mb, mb.offX, mb.offY, mb.offZ); for (MultiblockComponent comp : mb.getComponents()) { ChunkCoordinates pos = comp.getRelativePosition(); doRenderComponent(mb, comp, pos.posX + mb.offX, pos.posY + mb.offY, pos.posZ + mb.offZ, 1); }/*from w w w. j a v a 2s . com*/ }
From source file:vazkii.b_baubles.client.core.handler.MultiblockRenderHandler.java
License:Open Source License
private static void doRenderComponent(Multiblock mb, MultiblockComponent comp, int x, int y, int z, float alpha) { GL11.glPushMatrix();//from w ww . j av a 2s . c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Block block = comp.getBlock(); int meta = comp.getMeta(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); blockRender.useInventoryTint = false; if (block == null) return; if (IMultiblockRenderHook.renderHooks.containsKey(block)) { GL11.glColor4f(1F, 1F, 1F, alpha); IMultiblockRenderHook renderHook = IMultiblockRenderHook.renderHooks.get(block); if (renderHook.needsTranslate(block)) { GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); } renderHook.renderBlockForMultiblock(blockAccess, mb, block, comp.getMeta(), blockRender, comp, alpha); } else { if (comp.shouldDoFancyRender()) { int color = block.colorMultiplier(blockAccess, x, y, z); float red = (color >> 16 & 255) / 255.0F; float green = (color >> 8 & 255) / 255.0F; float blue = (color & 255) / 255.0F; GL11.glColor4f(red, green, blue, alpha); IBlockAccess oldBlockAccess = blockRender.blockAccess; blockRender.blockAccess = blockAccess; Tessellator tessellator = Tessellator.instance; blockRender.renderAllFaces = true; tessellator.startDrawingQuads(); tessellator.disableColor(); try { blockRender.renderBlockByRenderType(block, x, y, z); } catch (Exception e) { comp.doFancyRender = false; } tessellator.draw(); blockRender.renderAllFaces = false; blockRender.blockAccess = oldBlockAccess; } else { int color = block.getRenderColor(meta); float red = (color >> 16 & 255) / 255.0F; float green = (color >> 8 & 255) / 255.0F; float blue = (color & 255) / 255.0F; GL11.glColor4f(red, green, blue, alpha); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); blockRender.renderBlockAsItem(block, meta, 1F); } } GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); }
From source file:vazkii.gencreator.client.SelectionRenderHandler.java
License:Creative Commons License
private void renderBlockOutlineAt(ChunkCoordinates pos, int color) { GL11.glPushMatrix();//from ww w . j a v a 2 s. c o m GL11.glTranslated(pos.posX - RenderManager.renderPosX, pos.posY + 1 - RenderManager.renderPosY, pos.posZ - RenderManager.renderPosZ); GL11.glScalef(1.0F, -1.0F, -1.0F); Color colorRGB = new Color(color); GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 127); renderBlockOutline(); GL11.glPopMatrix(); }