Java Code Examples for net.minecraft.client.renderer.OpenGlHelper#glBlendFunc()
The following examples show how to use
net.minecraft.client.renderer.OpenGlHelper#glBlendFunc() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderUtils.java From LiquidBounce with GNU General Public License v3.0 | 5 votes |
public static void drawImage(ResourceLocation image, int x, int y, int width, int height) { glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glDepthMask(false); OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(image); Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, width, height, width, height); glDepthMask(true); glDisable(GL_BLEND); glEnable(GL_DEPTH_TEST); }
Example 2
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
private void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_) { float f = (p_73733_5_ >> 24 & 255) / 255.0F; float f1 = (p_73733_5_ >> 16 & 255) / 255.0F; float f2 = (p_73733_5_ >> 8 & 255) / 255.0F; float f3 = (p_73733_5_ & 255) / 255.0F; float f4 = (p_73733_6_ >> 24 & 255) / 255.0F; float f5 = (p_73733_6_ >> 16 & 255) / 255.0F; float f6 = (p_73733_6_ >> 8 & 255) / 255.0F; float f7 = (p_73733_6_ & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f1, f2, f3, f); tessellator.addVertex(p_73733_3_, p_73733_2_, 300f); tessellator.addVertex(p_73733_1_, p_73733_2_, 300f); tessellator.setColorRGBA_F(f5, f6, f7, f4); tessellator.addVertex(p_73733_1_, p_73733_4_, 300f); tessellator.addVertex(p_73733_3_, p_73733_4_, 300f); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 3
Source File: FxLaserHeat.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //worldRendererIn.finishDrawing(); float x = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); int i = this.getBrightnessForRender(0); int j = i >> 16 & 65535; int k = i & 65535; GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); GlStateManager.color(0.8f, 0.2f, 0.2f, particleAlpha); double size = this.size*particleAlpha; RenderHelper.renderCube(buffer, x - size, y - size, z - size, x + size, y + size, z + size); Tessellator.getInstance().draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); GlStateManager.color(1, 1, 1, 1); GL11.glLineWidth(1); }
Example 4
Source File: RenderButtonUIEntity.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void doRender(EntityUIButton entity, double x, double y, double z, float entityYaw, float partialTicks) { GL11.glPushMatrix(); GL11.glTranslated(0, -.25, 0); RenderHelper.renderTag(Minecraft.getMinecraft().player.getDistanceSqToEntity(entity), "Up a level", x,y,z, 8); GL11.glPopMatrix(); //Clean up and make player not transparent OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); }
Example 5
Source File: GuiPeripheral.java From AgriCraft with MIT License | 5 votes |
public void drawButton(Minecraft minecraft, int x, int y) { if (this.visible) { FontRenderer fontrenderer = minecraft.fontRenderer; minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.hovered = x >= this.x && y >= this.y && x < this.x + this.width && y < this.y + this.height; int k = this.getHoverState(this.isMouseOver()); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); int vOffset = isActive() ? 86 : 46 + k * 20; this.drawTexturedModalRect(this.x, this.y, 0, vOffset, this.width / 2, this.height); this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2, vOffset, this.width / 2, this.height); this.mouseDragged(minecraft, x, y); int l = 14737632; if (packedFGColour != 0) { l = packedFGColour; } else if (!this.enabled) { l = 10526880; } else if (this.hovered) { l = 16777120; } float scale = 0.6F; GL11.glScalef(scale, scale, scale); this.drawCenteredString(fontrenderer, this.displayString, (int) ((this.x + this.width / 2) / scale), (int) ((this.y + (this.height - 4) / 2) / scale), l); GL11.glScalef(1 / scale, 1 / scale, 1 / scale); } }
Example 6
Source File: GuiScroll.java From VersionChecker with GNU Lesser General Public License v3.0 | 5 votes |
protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { int f = (par5 >> 24 & 255); float f1 = (float)(par5 >> 16 & 255) / 255.0F; float f2 = (float)(par5 >> 8 & 255) / 255.0F; float f3 = (float)(par5 & 255) / 255.0F; int f4 = (par6 >> 24 & 255); float f5 = (float)(par6 >> 16 & 255) / 255.0F; float f6 = (float)(par6 >> 8 & 255) / 255.0F; float f7 = (float)(par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); //POSITION_TEX_COLOR? buffer.pos((double)par3, (double)par2, 0.0D).color(f1, f2, f3, f).endVertex(); buffer.pos((double)par1, (double)par2, 0.0D).color(f1, f2, f3, f).endVertex(); buffer.pos((double)par1, (double)par4, 0.0D).color(f5, f6, f7, f4).endVertex(); buffer.pos((double)par3, (double)par4, 0.0D).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 7
Source File: ItemBowRenderer.java From Et-Futurum with The Unlicense | 4 votes |
@Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); ResourceLocation resource = textureManager.getResourceLocation(stack.getItemSpriteNumber()); EntityPlayer player = Minecraft.getMinecraft().thePlayer; ItemStack usingItem = player.getItemInUse(); int useRemaining = player.getItemInUseCount(); ItemBow bow = (ItemBow) stack.getItem(); IIcon icon = bow.getIcon(stack, 0); if (usingItem != null && usingItem == stack) { int charge = stack.getMaxItemUseDuration() - useRemaining; if (charge >= 18) icon = bow.getItemIconForUseDuration(2); else if (charge > 13) icon = bow.getItemIconForUseDuration(1); else if (charge > 0) icon = bow.getItemIconForUseDuration(0); } if (icon == null) icon = ((TextureMap) textureManager.getTexture(resource)).getAtlasSprite("missingno"); OpenGLHelper.pushMatrix(); textureManager.bindTexture(resource); OpenGLHelper.colour(bow.getColorFromItemStack(stack, 0)); OpenGLHelper.disableLighting(); OpenGLHelper.enableAlpha(); OpenGLHelper.enableBlend(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); renderItem.renderIcon(0, 0, icon, 16, 16); OpenGLHelper.enableLighting(); OpenGLHelper.disableAlpha(); OpenGLHelper.disableBlend(); if (stack.hasEffect(0)) renderItem.renderEffect(textureManager, 0, 0); OpenGLHelper.popMatrix(); }
Example 8
Source File: TileEntityNewBeaconRenderer.java From Et-Futurum with The Unlicense | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTickTime) { TileEntityNewBeacon beacon = (TileEntityNewBeacon) tile; float f1 = beacon.func_146002_i(); OpenGLHelper.alphaFunc(GL11.GL_GREATER, 0.1F); if (f1 > 0.0F) { Tessellator tessellator = Tessellator.instance; List<BeamSegment> list = beacon.getSegments(); int j = 0; for (int i = 0; i < list.size(); i++) { BeamSegment beamsegment = list.get(i); int l = j + beamsegment.func_177264_c(); bindTexture(BEAM_TEXTURE); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); OpenGLHelper.disableLighting(); OpenGLHelper.disableCull(); OpenGLHelper.disableBlend(); OpenGLHelper.depthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = tile.getWorldObj().getTotalWorldTime() + partialTickTime; float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F); double d3 = f2 * 0.025D * -1.5D; tessellator.startDrawingQuads(); double d4 = 0.2D; double d5 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d4; double d6 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d4; double d7 = 0.5D + Math.cos(d3 + Math.PI / 4D) * d4; double d8 = 0.5D + Math.sin(d3 + Math.PI / 4D) * d4; double d9 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d4; double d10 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d4; double d11 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d4; double d12 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d4; double d13 = 0.0D; double d14 = 1.0D; double d15 = -1.0F + f3; double d16 = beamsegment.func_177264_c() * f1 * (0.5D / d4) + d15; tessellator.setColorRGBA_F(beamsegment.func_177263_b()[0], beamsegment.func_177263_b()[1], beamsegment.func_177263_b()[2], 0.125F); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d14, d16); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d14, d15); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d13, d15); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d13, d16); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d14, d16); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d14, d15); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d13, d15); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d13, d16); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d14, d16); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d14, d15); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d13, d15); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d13, d16); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d14, d16); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d14, d15); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d13, d15); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d13, d16); tessellator.draw(); OpenGLHelper.enableBlend(); OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGLHelper.depthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(beamsegment.func_177263_b()[0], beamsegment.func_177263_b()[1], beamsegment.func_177263_b()[2], 0.125F); d3 = 0.2D; d4 = 0.2D; d5 = 0.8D; d6 = 0.2D; d7 = 0.2D; d8 = 0.8D; d9 = 0.8D; d10 = 0.8D; d11 = 0.0D; d12 = 1.0D; d13 = -1.0F + f3; d14 = beamsegment.func_177264_c() * f1 + d13; tessellator.addVertexWithUV(x + d3, y + l, z + d4, d12, d14); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d12, d13); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d11, d13); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d11, d14); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d12, d14); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d12, d13); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d11, d13); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d11, d14); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d12, d14); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d12, d13); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d11, d13); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d11, d14); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d12, d14); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d12, d13); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d11, d13); tessellator.addVertexWithUV(x + d3, y + l, z + d4, d11, d14); tessellator.draw(); OpenGLHelper.enableLighting(); OpenGLHelper.enableTexture2D(); OpenGLHelper.depthMask(true); j = l; } } }
Example 9
Source File: FxLaser.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //worldRendererIn.finishDrawing(); float x = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); int i = this.getBrightnessForRender(0); int j = i >> 16 & 65535; int k = i & 65535; double radius = .3f; double fwdOffset = 0.075f; double entityOffX = entityFrom.posX - MathHelper.cos((float) (entityFrom.rotationYaw * Math.PI/180f))*radius + fwdOffset*MathHelper.sin((float) (entityFrom.rotationYaw * Math.PI/180f)); double entityOffY = entityFrom.posY + (entityFrom.getEntityId() == entityIn.getEntityId() && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 ? entityIn.getEyeHeight() - 0.12f : 1.15f); double entityOffZ = entityFrom.posZ - MathHelper.sin((float) (entityFrom.rotationYaw * Math.PI/180f))*radius - fwdOffset*MathHelper.cos((float) (entityFrom.rotationYaw * Math.PI/180f)); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); GL11.glLineWidth(5); GlStateManager.color(0.8f, 0.2f, 0.2f, .4f); buffer.pos(entityOffX - entityIn.posX, entityOffY - entityIn.posY, entityOffZ - entityIn.posZ).endVertex(); buffer.pos(x, y, z).endVertex(); Tessellator.getInstance().draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); GlStateManager.color(1, 1, 1, 1); GL11.glLineWidth(1); }
Example 10
Source File: FxLaserSpark.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { //worldRendererIn.finishDrawing(); float x = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX); float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY); float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ); int i = this.getBrightnessForRender(0); int j = i >> 16 & 65535; int k = i & 65535; GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); GL11.glLineWidth(1); GlStateManager.color(0.8f, 0.2f, 0.2f, particleAlpha); x += motionX*particleAge; y += motionY*particleAge; z += motionZ*particleAge; buffer.pos(x,y,z).endVertex(); buffer.pos(x + motionX*length,y + motionY*length,z + motionZ*length).endVertex(); Tessellator.getInstance().draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); GlStateManager.color(1, 1, 1, 1); GL11.glLineWidth(1); }
Example 11
Source File: RenderLaser.java From AdvancedRocketry with MIT License | 4 votes |
public void doRender(Particle entity, double x, double y, double z, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslated(x, y, z); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Minecraft.getMinecraft().renderEngine.bindTexture(flare); //bindTexture(flare); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GlStateManager.color(flareColor[0],flareColor[1],flareColor[2],flareColor[3]); for(int i = 0; i < 4; i++) { RenderHelper.renderBottomFaceWithUV(buffer, -y + 200, -(i*6) - x, -(i*6) - z, (i*6) - x, (i*6) - z, 0, 1, 0, 1); } Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, 0, 0); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); GlStateManager.color(color[0], color[1], color[2], color[3]);//0.9F, 0.2F, 0.3F, 0.5F); for(float radius = 0.25F; radius < size; radius += .25F) { for(double i = 0; i < 2*Math.PI; i += Math.PI) { buffer.pos(- x , -y + 200, - z).endVertex(); buffer.pos(- x, -y + 200, - z).endVertex(); buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,- (radius* Math.sin(i)) + 0.5F).endVertex(); buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, (radius* Math.cos(i)) + 0.5F).endVertex(); } for(double i = 0; i < 2*Math.PI; i += Math.PI) { buffer.pos(- x, -y + 200,- z).endVertex(); buffer.pos(- x, -y + 200, - z).endVertex(); buffer.pos(+ (radius* Math.sin(i)) + 0.5F, 0, -(radius* Math.cos(i)) + 0.5F).endVertex(); buffer.pos(- (radius* Math.cos(i)) + 0.5F, 0,(radius* Math.sin(i)) + 0.5F).endVertex(); } } Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_FOG); GL11.glDepthMask(true); GL11.glPopMatrix(); GlStateManager.color(1f, 1f, 1f,1f); //Clean up and make player not transparent OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); }
Example 12
Source File: RocketEventHandler.java From AdvancedRocketry with MIT License | 4 votes |
public static void onPostWorldRender(float partialTicks) { if(!mapReady ) return; if(mapNeedsBinding) { mapNeedsBinding = false; earth.setByteBuffer(table); outerBounds.setByteBuffer(outerBoundsTable); } GL11.glPushMatrix(); GL11.glTranslatef(0, -5, 0); GL11.glPushAttrib(GL11.GL_ALPHA_TEST_FUNC); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_FOG); GL11.glAlphaFunc(GL11.GL_GREATER, .01f); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float brightness = 16; if(Minecraft.getMinecraft().getRenderViewEntity() != null && Minecraft.getMinecraft().getRenderViewEntity().world != null) brightness = Minecraft.getMinecraft().getRenderViewEntity().world.getSunBrightness(partialTicks); double deltaY = (Minecraft.getMinecraft().getRenderViewEntity().posY - Minecraft.getMinecraft().getRenderViewEntity().lastTickPosY)*partialTicks; double size = (getImgSize*5/(72-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Less detailed land buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, outerBounds.getTextureId()); double size2 = size*16; float brightness2 =brightness*.43f; GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10.1, size2, size2, -size2, -size2, 0, 1, 0, 1); Tessellator.getInstance().draw(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, earth.getTextureId()); float opacityFromHeight = MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/100f, 0f, 1f); //Detailed Land GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10 , size, size, -size, -size, 0f, 1f, 0f, 1f); Tessellator.getInstance().draw(); //AtmosphereGlow Vec3d skyColor = Minecraft.getMinecraft().getRenderViewEntity().world.provider.getSkyColor(Minecraft.getMinecraft().getRenderViewEntity(), partialTicks); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D,0); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); GlStateManager.color((float)skyColor.x, (float)skyColor.y, (float)skyColor.z, 0.05f); size = (getImgSize*100/(180-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); for(int i = 0; i < 5 * MathHelper.clamp(( ( DimensionManager.getInstance().getDimensionProperties(Minecraft.getMinecraft().getRenderViewEntity().world.provider.getDimension()).getAtmosphereDensity() *.01f * (float)Minecraft.getMinecraft().getRenderViewEntity().posY -280f) )/150f, 0f, 2f); i++) { RenderHelper.renderTopFace(buffer, -9 + i*.6, size, size, -size , -size); } // GL11.glEnable(GL11.GL_TEXTURE_2D); Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_FOG); GL11.glPopAttrib(); GL11.glPopMatrix(); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); }
Example 13
Source File: GuiEnderUtilities.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
/** * Draw the template stacks from a "lockable inventory" for otherwise empty slots * @param inv */ protected void drawTemplateStacks(ItemStackHandlerLockable inv) { // Draw a faint version of the template item for empty locked slots RenderHelper.enableGUIStandardItemLighting(); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); GlStateManager.enableRescaleNormal(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f); this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; int invSize = inv.getSlots(); for (int slotNum = 0; slotNum < invSize; slotNum++) { Slot slot = this.inventorySlots.getSlot(slotNum); if (inv.isSlotLocked(slotNum) && inv.getStackInSlot(slotNum).isEmpty()) { ItemStack stack = inv.getTemplateStackInSlot(slotNum); if (stack.isEmpty() == false) { int x = this.guiLeft + slot.xPos; int y = this.guiTop + slot.yPos; GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.enableBlend(); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); } } } this.itemRender.zLevel = 0.0F; this.zLevel = 0.0F; GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); RenderHelper.enableStandardItemLighting(); }
Example 14
Source File: RenderCarvableBeacon.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) { float f1 = beacon.func_146002_i(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if(f1 > 0.1F){ Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]); Tessellator tessellator = Tessellator.instance; this.bindTexture(texture); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks; float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F); byte b0 = 1; double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d5 = (double) b0 * 0.2D; double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5; double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5; double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5; double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5; double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5; double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5; double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5; double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5; double d23 = (double) (256.0F * f1); double d25 = 0.0D; double d27 = 1.0D; double d28 = (double) (-1.0F + f3); double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28; tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29); tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28); tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29); tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28); tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29); tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28); tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29); tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28); tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28); tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29); tessellator.draw(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d30 = 0.2D; double d4 = 0.2D; double d6 = 0.8D; double d8 = 0.2D; double d10 = 0.2D; double d12 = 0.8D; double d14 = 0.8D; double d16 = 0.8D; double d18 = (double) (256.0F * f1); double d20 = 0.0D; double d22 = 1.0D; double d24 = (double) (-1.0F + f3); double d26 = (double) (256.0F * f1) + d24; tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26); tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24); tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26); tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24); tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26); tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24); tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26); tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24); tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24); tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } }