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:tk.wurst_client.features.mods.AutoBuildMod.java
License:Open Source License
@Override public void onRender() { if (!building || blockIndex >= positions.size()) return;/*from w ww . j a v a 2s. c om*/ // scale and offset double scale = 1D * 7D / 8D; double offset = (1D - scale) / 2D; // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix(); GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY, -mc.getRenderManager().renderPosZ); // green box { GL11.glDepthMask(false); GL11.glColor4f(0F, 1F, 0F, 0.15F); BlockPos pos = positions.get(blockIndex); GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); RenderUtils.drawSolidBox(); GL11.glPopMatrix(); GL11.glDepthMask(true); } // black outlines GL11.glColor4f(0F, 0F, 0F, 0.5F); for (int i = blockIndex; i < positions.size(); i++) { BlockPos pos = positions.get(i); GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:tk.wurst_client.features.mods.TemplateToolMod.java
License:Open Source License
@Override public void onRender() { // scale and offset double scale = 7D / 8D; double offset = (1D - scale) / 2D; // GL settings GL11.glEnable(GL11.GL_BLEND);//from w w w . j a v a 2s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY, -mc.getRenderManager().renderPosZ); // area if (area != null) { GL11.glEnable(GL11.GL_DEPTH_TEST); // recently scanned blocks if (step == Step.SCAN_AREA && area.progress < 1) for (int i = Math.max(0, area.blocksFound.size() - area.scanSpeed); i < area.blocksFound .size(); i++) { BlockPos pos = area.blocksFound.get(i); GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(-0.005, -0.005, -0.005); GL11.glScaled(1.01, 1.01, 1.01); GL11.glColor4f(0F, 1F, 0F, 0.15F); RenderUtils.drawSolidBox(); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } GL11.glPushMatrix(); GL11.glTranslated(area.minX + offset, area.minY + offset, area.minZ + offset); GL11.glScaled(area.sizeX + scale, area.sizeY + scale, area.sizeZ + scale); // area scanner if (area.progress < 1) { GL11.glPushMatrix(); GL11.glTranslated(0, 0, area.progress); GL11.glScaled(1, 1, 0); GL11.glColor4f(0F, 1F, 0F, 0.3F); RenderUtils.drawSolidBox(); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); // template scanner } else if (template != null && template.progress > 0) { GL11.glPushMatrix(); GL11.glTranslated(0, 0, template.progress); GL11.glScaled(1, 1, 0); GL11.glColor4f(0F, 1F, 0F, 0.3F); RenderUtils.drawSolidBox(); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } // area box GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); } // sorted blocks if (template != null) { for (BlockPos pos : template.sortedBlocks) { GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } } // selected positions for (Step step : Step.SELECT_POSITION_STEPS) { BlockPos pos = step.pos; if (pos == null) continue; GL11.glPushMatrix(); GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); GL11.glColor4f(0F, 1F, 0F, 0.15F); RenderUtils.drawSolidBox(); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } // posLookingAt if (posLookingAt != null) { GL11.glPushMatrix(); GL11.glTranslated(posLookingAt.getX(), posLookingAt.getY(), posLookingAt.getZ()); GL11.glTranslated(offset, offset, offset); GL11.glScaled(scale, scale, scale); GL11.glColor4f(0.25F, 0.25F, 0.25F, 0.15F); RenderUtils.drawSolidBox(); GL11.glColor4f(0F, 0F, 0F, 0.5F); RenderUtils.drawOutlinedBox(); GL11.glPopMatrix(); } GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:tk.wurst_client.features.mods.TemplateToolMod.java
License:Open Source License
@Override public void onRenderGUI() { // GL settings GL11.glEnable(GL11.GL_BLEND);//from w w w. j av a 2 s.com GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPushMatrix(); String message; if (step.selectPos && step.pos != null) message = "Press enter to confirm, or select a different position."; else if (step == Step.FILE_NAME && file != null && file.exists()) message = "WARNING: This file already exists."; else message = step.message; // translate to center ScaledResolution sr = new ScaledResolution(mc); int msgWidth = Fonts.segoe15.getStringWidth(message); GL11.glTranslated(sr.getScaledWidth() / 2 - msgWidth / 2, sr.getScaledHeight() / 2 + 1, 0); // background GL11.glColor4f(0, 0, 0, 0.5F); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2d(0, 0); GL11.glVertex2d(msgWidth + 2, 0); GL11.glVertex2d(msgWidth + 2, 10); GL11.glVertex2d(0, 10); } GL11.glEnd(); // text GL11.glEnable(GL11.GL_TEXTURE_2D); Fonts.segoe15.drawString(message, 2, -1, 0xffffffff); GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); }
From source file:us.illyohs.magoi.client.render.tile.RenderModelManaStore.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick) { TileManaStore tms = (TileManaStore) te; GL11.glDisable(GL11.GL_CULL_FACE);//from ww w . jav a 2 s. c om GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 0.5); GL11.glScalef(1F, -1F, -1F); Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE); model.render(.0625F); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_LIGHTING); }
From source file:us.illyohs.wumbo.client.render.RenderGuildCore.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float tick) { TileGuildCore tgc = (TileGuildCore) tile; GL11.glPushMatrix();/* w ww . j ava 2 s. co m*/ GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 2.5); GL11.glScalef(1F, -1F, -1F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(LibAssets.ASSET_GUILD_CORE_FRAME); frame.render(.0625F); // core.render(); // GL11.glScalef(1F, -1F, -1F); GL11.glBlendFunc(0, 1); GL11.glClearColor(0.7f, 0.7f, 0.7f, 1.0f); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated((float) x + 1.0, (float) y + 2.0, (float) z + 1.0); GL11.glScalef(1F, -1F, -1F); core.render8(); GL11.glPopMatrix(); }
From source file:us.samcraft.thaumickeeper.client.render.RenderKeeper.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) { TileSpaceKeeper tKeeper = (TileSpaceKeeper) tileentity; GL11.glPushMatrix();/* w w w . j a va 2s . c o m*/ GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 0.5); GL11.glScalef(1F, -1F, -1F); Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE); model.render(.0625F); GL11.glScalef(1F, -1F, -1F); GL11.glBlendFunc(0, 1); GL11.glClearColor(0.7f, 0.7f, 0.7f, 1.0f); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.combat.render.EntityCannonBasicRender.java
License:Open Source License
@Override public void doRender(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) { float paritalTickYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks; float paritalTickPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; double renderYaw = -paritalTickYaw + 90f; double renderPitch = paritalTickPitch; bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); // entity.posX += 15; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; GL11.glPushMatrix();/*from w w w . j ava 2 s . c o m*/ GlStateManager.disableLighting(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); double offsetAngle = entity.getBaseAngleOffset(); GL11.glRotated(offsetAngle, 0, 1D, 0); GL11.glPushMatrix(); GL11.glTranslated(-.1D, 0, 0); renderBase(entity, x, y, z, entityYaw, partialTicks); GL11.glPopMatrix(); GL11.glTranslated(.15D, .5D, 0); GL11.glRotated(renderYaw - offsetAngle, 0, 1D, 0); GL11.glRotated(renderPitch, 0, 0, 1D); GL11.glTranslated(-.8D, 0, -0.25); GL11.glPushMatrix(); renderHead(entity, x, y, z, entityYaw, partialTicks); GL11.glPopMatrix(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.disableLighting(); GlStateManager.resetColor(); GlStateManager.enableLighting(); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.combat.render.EntityCannonBasicRender.java
License:Open Source License
private void renderBase(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); GL11.glPushMatrix();/* w w w. ja va2s .c om*/ GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, entity.world, baseState, entity.getBrightnessForRender()); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.combat.render.EntityCannonBasicRender.java
License:Open Source License
private void renderHead(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); GL11.glPushMatrix();/*w w w .ja va 2s.com*/ GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, entity.world, headState, entity.getBrightnessForRender()); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.control.renderer.BasicNodeTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntity te, double x, double y, double z, float partialTick, int destroyStage, float alpha) { if (te instanceof BasicNodeTileEntity) { GlStateManager.disableBlend();//from w w w . ja va 2 s . c o m Node tileNode = ((BasicNodeTileEntity) (te)).getNode(); if (tileNode != null) { GL11.glPushMatrix(); GL11.glTranslated(.5D, -1D, .5D); // GL11.glTranslated(0, y, 0); for (BlockPos otherPos : tileNode.getConnectedNodesBlockPos()) { // render wire between these two blockPos GL11.glPushMatrix(); // GlStateManager.resetColor(); double startX = te.getPos().getX(); double startY = te.getPos().getY(); double startZ = te.getPos().getZ(); double endX = (startX * 2) - otherPos.getX(); double endY = (startY * 2) - otherPos.getY() - 1.5; double endZ = (startZ * 2) - otherPos.getZ(); renderWire(x, y, z, startX, startY, startZ, endX, endY, endZ); // GL11.glEnd(); GL11.glPopMatrix(); } GlStateManager.resetColor(); // bindTexture(new ResourceLocation("textures/entity/lead_knot.png")); // GlStateManager.scale(-1.0F, -1.0F, 1.0F); // ModelLeashKnot knotRenderer = new ModelLeashKnot(); // knotRenderer.knotRenderer.render(0.0625F); // BlockPos originPos = te.getPos(); GL11.glPopMatrix(); } } }