List of usage examples for org.lwjgl.opengl GL11 glPopAttrib
public static native void glPopAttrib();
From source file:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
private void renderFluids(Pipe<PipeTransportFluids> pipe, double x, double y, double z) { PipeTransportFluids trans = pipe.transport; boolean needsRender = false; for (int i = 0; i < 7; ++i) { FluidStack fluidStack = trans.renderCache[i]; if (fluidStack != null && fluidStack.amount > 0) { needsRender = true;//from w ww. j av a 2s. c om break; } } if (!needsRender) { return; } GL11.glPushMatrix(); 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((float) x, (float) y, (float) z); // sides boolean sides = false, above = false; for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { int i = side.ordinal(); FluidStack fluidStack = trans.renderCache[i]; if (fluidStack == null || fluidStack.amount <= 0) { continue; } if (!pipe.container.isPipeConnected(side)) { continue; } DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d == null) { continue; } int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); GL11.glPushMatrix(); int list = 0; switch (ForgeDirection.VALID_DIRECTIONS[i]) { case UP: above = true; list = d.sideVertical[stage]; break; case DOWN: GL11.glTranslatef(0, -0.75F, 0); list = d.sideVertical[stage]; break; case EAST: case WEST: case SOUTH: case NORTH: sides = true; // Yes, this is kind of ugly, but was easier than transform the coordinates above. GL11.glTranslatef(0.5F, 0.0F, 0.5F); GL11.glRotatef(angleY[i], 0, 1, 0); GL11.glRotatef(angleZ[i], 0, 0, 1); GL11.glTranslatef(-0.5F, 0.0F, -0.5F); list = d.sideHorizontal[stage]; break; default: } bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[i]); GL11.glCallList(list); GL11.glPopMatrix(); } // CENTER FluidStack fluidStack = trans.renderCache[ForgeDirection.UNKNOWN.ordinal()]; if (fluidStack != null && fluidStack.amount > 0) { DisplayFluidList d = getListFromBuffer(fluidStack, pipe.container.getWorldObj()); if (d != null) { int stage = (int) ((float) fluidStack.amount / (float) (trans.getCapacity()) * (LIQUID_STAGES - 1)); bindTexture(TextureMap.locationBlocksTexture); RenderUtils.setGLColorFromInt(trans.colorRenderCache[ForgeDirection.UNKNOWN.ordinal()]); if (above) { GL11.glCallList(d.centerVertical[stage]); } if (!above || sides) { GL11.glCallList(d.centerHorizontal[stage]); } } } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:com.lothrazar.cyclicmagic.block.melter.FluidMelterTESR.java
License:Open Source License
@Override public void render(TileMelter te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { FluidStack fluidStack = te.getCurrentFluidStack(); if (fluidStack == null) { return;//w ww. j av a 2 s . c o m } GlStateManager.pushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); if (fluidStack != null) { Fluid fluid = fluidStack.getFluid(); Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //TODO: fluid liumin UtilRenderMekanismFluid.glowOn(fluid.getLuminosity()); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getStill().toString()); TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getFlowing().toString()); //so we get range smaller THAN [0,1] -> avoids texture layer fighting double start = 0.01; double scale = .89; double posY = start + (scale * ((float) fluidStack.amount / (float) te.getCapacity())); int icolor = fluidStack.getFluid().getColor(fluidStack); //RGB encoded in hexval integer float red = (icolor >> 16 & 0xFF) / 255.0F; float green = (icolor >> 8 & 0xFF) / 255.0F; float blue = (icolor & 0xFF) / 255.0F; float alph = 1.0F; // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/ // T/B for top and bottom float T = 15.9F / 16F; float B = 0.1F / 16F; int S = 0, E = 16;//for start and end. vertex ranges from [0,16]; //TOP SIDE buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //BOTTOM SIDE buffer.setTranslation(x, y - posY + B, z);// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //the +Z side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //now the opposite: -Z side buffer.setTranslation(x, y, z + 1); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the +X side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the -X side buffer.setTranslation(x - 1 + 2 * B, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); buffer.setTranslation(0, 0, 0); UtilRenderMekanismFluid.glowOff(); } GL11.glPopAttrib(); GlStateManager.popMatrix(); }
From source file:com.lothrazar.cyclicmagic.block.solidifier.FluidSolidifierTESR.java
License:Open Source License
@Override public void render(TileSolidifier te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { FluidStack fluidStack = te.getCurrentFluidStack(); if (fluidStack == null) { return;/*from w ww .j a va 2s. c om*/ } GlStateManager.pushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); if (fluidStack != null) { Fluid fluid = fluidStack.getFluid(); Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //TODO: fluid liumin UtilRenderMekanismFluid.glowOn(fluid.getLuminosity()); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getStill().toString()); TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getFlowing().toString()); //so we get range smaller THAN [0,1] -> avoids texture layer fighting double start = 0.01; double scale = .89; double posY = start + (scale * ((float) fluidStack.amount / (float) te.getCapacity())); int icolor = fluidStack.getFluid().getColor(fluidStack); //RGB encoded in hexval integer float red = (icolor >> 16 & 0xFF) / 255.0F; float green = (icolor >> 8 & 0xFF) / 255.0F; float blue = (icolor & 0xFF) / 255.0F; float alph = 1.0F; // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/ // T/B for top and bottom float T = 15.9F / 16F; float B = 0.1F / 16F; int S = 1, E = 15;//for start and end. vertex ranges from [0,16]; //TOP SIDE buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //BOTTOM SIDE buffer.setTranslation(x, y - posY + B, z);// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //the +Z side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //now the opposite: -Z side buffer.setTranslation(x, y, z + 1); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the +X side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the -X side buffer.setTranslation(x - 1 + 2 * B, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); buffer.setTranslation(0, 0, 0); UtilRenderMekanismFluid.glowOff(); } GL11.glPopAttrib(); GlStateManager.popMatrix(); }
From source file:com.lothrazar.cyclicmagic.block.tank.FluidTESR.java
License:Open Source License
@Override public void render(TileEntityFluidTank te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { FluidStack fluidStack = te.getCurrentFluidStack(); if (fluidStack == null) { return;//w w w . j av a 2 s .c o m } GlStateManager.pushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); if (fluidStack != null) { Fluid fluid = fluidStack.getFluid(); Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //TODO: fluid liumin UtilRenderMekanismFluid.glowOn(fluid.getLuminosity()); TextureAtlasSprite still = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getStill().toString()); TextureAtlasSprite flow = Minecraft.getMinecraft().getTextureMapBlocks() .getAtlasSprite(fluid.getFlowing().toString()); //so we get range smaller THAN [0,1] -> avoids texture layer fighting double posY = 0.01 + (.985 * ((float) fluidStack.amount / (float) te.getCapacity())); int icolor = fluidStack.getFluid().getColor(fluidStack); //RGB encoded in hexval integer float red = (icolor >> 16 & 0xFF) / 255.0F; float green = (icolor >> 8 & 0xFF) / 255.0F; float blue = (icolor & 0xFF) / 255.0F; float alph = 1.0F; // THANKS FOR POST http://www.minecraftforge.net/forum/topic/44388-1102-render-fluid-level-in-tank-with-tesr/ // T/B for top and bottom float T = 15.9F / 16F; float B = 0.1F / 16F; int S = 1, E = 15;//for start and end. vertex ranges from [0,16]; //TOP SIDE buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, 1).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, 1).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(1, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //BOTTOM SIDE buffer.setTranslation(x, y - posY + B, z);// buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(B, posY, B).tex(still.getInterpolatedU(S), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(still.getInterpolatedU(E), still.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(still.getInterpolatedU(E), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(still.getInterpolatedU(S), still.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //the +Z side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); //now the opposite: -Z side buffer.setTranslation(x, y, z + 1); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, -1 * T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, B, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(B, posY, -1 * T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the +X side buffer.setTranslation(x, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, B, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); tess.draw(); // the -X side buffer.setTranslation(x - 1 + 2 * B, y, z); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); buffer.pos(T, posY, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, B).tex(flow.getInterpolatedU(S), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, B, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(E)) .color(red, green, blue, alph).endVertex(); buffer.pos(T, posY, T).tex(flow.getInterpolatedU(E), flow.getInterpolatedV(S)) .color(red, green, blue, alph).endVertex(); tess.draw(); buffer.setTranslation(0, 0, 0); UtilRenderMekanismFluid.glowOff(); } GL11.glPopAttrib(); GlStateManager.popMatrix(); }
From source file:com.shinoow.abyssalcraft.common.items.armor.ItemDepthsArmor.java
License:Apache License
@Override @SideOnly(Side.CLIENT)/*from w ww. j a va2s .c o m*/ public void renderHelmetOverlay(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks, boolean hasScreen, int mouseX, int mouseY) { final ResourceLocation coraliumBlur = new ResourceLocation("abyssalcraft:textures/misc/coraliumblur.png"); if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && stack != null && stack.getItem() == AbyssalCraft.Depthshelmet) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); Tessellator t = Tessellator.instance; ScaledResolution scale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); int width = scale.getScaledWidth(); int height = scale.getScaledHeight(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST); Minecraft.getMinecraft().renderEngine.bindTexture(coraliumBlur); t.startDrawingQuads(); t.addVertexWithUV(0.0D, height, 90.0D, 0.0D, 1.0D); t.addVertexWithUV(width, height, 90.0D, 1.0D, 1.0D); t.addVertexWithUV(width, 0.0D, 90.0D, 1.0D, 0.0D); t.addVertexWithUV(0.0D, 0.0D, 90.0D, 0.0D, 0.0D); t.draw(); GL11.glPopAttrib(); } }
From source file:com.smithsmodding.smithscore.util.client.gui.GuiHelper.java
/** * Disables all Scissors currently active */ public static void disableScissor() { GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glPopAttrib(); }
From source file:com.specialeffect.gui.IconOverlay.java
License:Open Source License
private void drawTexture() { // calculate position int height = (int) (mDisplayHeight * mHeight); int width = (int) (height * mAspectRatio); int centreX = (int) (mCentreX * mDisplayWidth); int centreY = (int) (mCentreY * mDisplayHeight); GL11.glDisable(GL11.GL_LIGHTING);/*from w ww . j a v a 2 s .c o m*/ GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); this.mc.renderEngine.bindTexture(mResource); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); GL11.glColor4f(1.0f, 1.0f, 1.0f, mAlpha); ModUtils.drawTexQuad(centreX - width / 2, centreY - height / 2, width, height); // reset GL attributes! GL11.glPopAttrib(); }
From source file:com.specialeffect.gui.JoystickControlOverlay.java
License:Open Source License
@SubscribeEvent public void onRenderExperienceBar(RenderGameOverlayEvent event) { // We draw after the ExperienceBar has drawn. The event raised by GuiIngameForge.pre() // will return true from isCancelable. If you call event.setCanceled(true) in // that case, the portion of rendering which this event represents will be canceled. // We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns // false and that the eventType represents the ExperienceBar event. if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) { return;/*from w ww . j ava 2 s.co m*/ } if (mVisible) { this.rescale(); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture(mResource); GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); GL11.glColor4f(1.0f, 1.0f, 1.0f, 0.5f); ModUtils.drawTexQuad(0, 0, mDisplayWidth, mDisplayHeight); // reset GL attributes! GL11.glPopAttrib(); } }
From source file:com.specialeffect.gui.StateOverlay.java
License:Open Source License
private void drawScaledTextureWithGlow(ResourceLocation res, int x, int y, int width, int height) { GL11.glPushAttrib(GL11.GL_TEXTURE_BIT); this.mc.renderEngine.bindTexture(res); // First draw enlarged and blurred, for glow. GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_ADD); // We draw the texture larger, in white, at progressive levels of alpha // for blur effect (the alpha gets added on each layer) int blurSteps = 4; // how many levels of progressive blur double totalBlur = width / 12; // in pixels GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f / blurSteps); for (int i = 0; i < blurSteps; i++) { double blurAmount = totalBlur / blurSteps * (i + 1); ModUtils.drawTexQuad(x - blurAmount, y - blurAmount, width + 2 * blurAmount, height + 2 * blurAmount); }/* w ww . j a v a 2 s . com*/ GL11.glTexEnvi(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE); GL11.glColor3f(1.0f, 1.0f, 1.0f); this.mc.renderEngine.bindTexture(res); ModUtils.drawTexQuad(x, y, width, height); // reset GL attributes! GL11.glPopAttrib(); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawOverdraw(int level) { GL11.glPushAttrib(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilFunc(level == 5 ? GL11.GL_LEQUAL : GL11.GL_EQUAL, level, 0xf); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glTranslatef(mNode.bounds.x, -mNode.bounds.y, 0.0f); if (level == 2) { loadColor(ColorType.OVERDRAW_BLUE); } else if (level == 3) { loadColor(ColorType.OVERDRAW_GREEN); } else if (level == 4) { loadColor(ColorType.OVERDRAW_RED_LOW); } else if (level > 4) { loadColor(ColorType.OVERDRAW_RED_HIGH); }/*w w w .j a v a 2s. c om*/ GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glVertex3f(mNode.bounds.width, 0.0f, 0.0f); GL11.glVertex3f(mNode.bounds.width, -mNode.bounds.height, 0.0f); GL11.glVertex3f(0.0f, -mNode.bounds.height, 0.0f); GL11.glEnd(); GL11.glPopAttrib(); }