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: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 ava 2 s . c o m*/ // 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 2 s . 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:totemic_commons.pokefenn.client.rendering.tileentity.TileTipiRenderer.java
License:MIT License
public void renderBlockYour(TileTipi tl, World world, int i, int j, int k, Block block) { Tessellator tessellator = Tessellator.instance; float f = block.getMixedBrightnessForBlock(world, i, j, k); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) l1, (float) l2); int dir = world.getBlockMetadata(i, j, k); GL11.glPushMatrix();/*from w w w . ja v a2 s .c om*/ GL11.glScaled(2.85, 2.85, 2.85); GL11.glTranslatef(0.18F, 1.55F, 0.18F); GL11.glRotatef(dir * (-90F), 0F, 1F, 0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); //GL11.glTranslatef(-0.5F, 0, -0.5F); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Resources.TEXTURE_TIPI); this.modelTipi.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.control.renderer.PropellerEngineTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityPropellerEngine tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { IBlockState state = tileentity.getWorld().getBlockState(tileentity.getPos()); if (state.getBlock() instanceof BlockAirshipEngine) { EnumFacing facing = state.getValue(BlockAirshipEngine.FACING); IBlockState engineRenderState = getRenderState(state); IBlockState propellerRenderState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel .getStateFromMeta(14);//from w ww.ja va 2 s. co m this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); // GL11.glScaled(1.2D, 1.2D, 1.2D); GL11.glTranslated(0.5D, 0.5D, 0.5D); switch (facing) { case UP: GL11.glRotated(-90, 1, 0, 0); break; case DOWN: GL11.glRotated(90, 1, 0, 0); break; case NORTH: GL11.glRotated(180, 0, 1, 0); break; case EAST: GL11.glRotated(90, 0, 1, 0); break; case SOUTH: GL11.glRotated(0, 0, 1, 0); break; case WEST: GL11.glRotated(270, 0, 1, 0); break; } GL11.glTranslated(-0.5D, -0.5D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), engineRenderState, brightness); GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0.21D, 0.5D); GL11.glRotated(tileentity.getPropellerAngle(partialTick), 0, 0, 1); GL11.glScaled(1.5D, 1.5D, 1); GL11.glTranslated(-0.5D, -0.21D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), propellerRenderState, brightness); GL11.glPopMatrix(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); } }
From source file:valkyrienwarfare.addon.control.renderer.ShipHelmTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityShipHelm tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { if (tileentity instanceof TileEntityShipHelm) { IBlockState helmState = tileentity.getWorld().getBlockState(tileentity.getPos()); if (helmState.getBlock() != ValkyrienWarfareControl.INSTANCE.blocks.shipHelm) { return; }//from ww w .j a va2s . com this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); double smoothCompassDif = (tileentity.compassAngle - tileentity.lastCompassAngle); if (smoothCompassDif < -180) { smoothCompassDif += 360; } if (smoothCompassDif > 180) { smoothCompassDif -= 360; } double smoothWheelDif = (tileentity.wheelRotation - tileentity.lastWheelRotation); if (smoothWheelDif < -180) { smoothWheelDif += 360; } if (smoothWheelDif > 180) { smoothWheelDif -= 360; } double smoothCompass = tileentity.lastCompassAngle + (smoothCompassDif) * partialTick + 180D; double smoothWheel = tileentity.lastWheelRotation + (smoothWheelDif) * partialTick; BlockPos originPos = tileentity.getPos(); IBlockState wheelState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(0); IBlockState compassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(1); IBlockState glassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(2); IBlockState helmStateToRender = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(3); // TODO: Better rendering cache int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); double multiplier = 2.0D; GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D); GL11.glScaled(multiplier, multiplier, multiplier); EnumFacing enumfacing = helmState.getValue(BlockShipHelm.FACING); double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), helmStateToRender, brightness); GL11.glPushMatrix(); GL11.glTranslated(.5, .522, 0); GL11.glRotated(smoothWheel, 0, 0, 1); GL11.glTranslated(-.5, -.522, 0); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), wheelState, brightness); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(smoothCompass, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), compassState, brightness); GL11.glPopMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), glassState, brightness); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.enableLighting(); GlStateManager.resetColor(); } }
From source file:valkyrienwarfare.addon.control.renderer.ShipTelegraphTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityShipTelegraph tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { IBlockState telegraphState = tileentity.getWorld().getBlockState(tileentity.getPos()); if (telegraphState.getBlock() != ValkyrienWarfareControl.INSTANCE.blocks.shipTelegraph) { return;// www . jav a 2 s. co m } this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); BlockPos originPos = tileentity.getPos(); IBlockState glassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(8); IBlockState dialState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(7); IBlockState leftHandleState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(6); IBlockState rightHandleState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(5); IBlockState helmStateToRender = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(4); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); double multiplier = 1.5D; GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D); GL11.glScaled(multiplier, multiplier, multiplier); EnumFacing enumfacing = telegraphState.getValue(BlockShipTelegraph.FACING); double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), helmStateToRender, brightness); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), dialState, brightness); GL11.glPushMatrix(); GL11.glTranslated(0.497D, 0.857D, 0.5D); GL11.glRotated(tileentity.getHandleRenderRotation(), 0D, 0D, 1D); GL11.glTranslated(-0.497D, -0.857D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), rightHandleState, brightness); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), leftHandleState, brightness); GL11.glPopMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), glassState, brightness); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.enableLighting(); GlStateManager.resetColor(); }