List of usage examples for org.lwjgl.opengl GL11 glEnable
public static void glEnable(@NativeType("GLenum") int target)
From source file:arg.RenderRecipe.java
License:Open Source License
@Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); this.mc.renderEngine.bindTexture(new ResourceLocation("arg", "textures/gui/crafting.png")); drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); // GL11.glDisable(GL11.GL_TEXTURE_2D); }
From source file:aritzh.afm.client.render.model.ModelTestModel.java
License:LGPL
public void render(final double x, final double y, final double z) { GL11.glPushMatrix();//from w ww . j a v a 2 s . c om GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x + .5, y - .5, z + .5); FMLClientHandler.instance().getClient().renderEngine .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_TESTMODEL)); this.model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:aritzh.afm.client.render.model.ModelWireless.java
License:LGPL
public void render(final double x, final double y, final double z) { GL11.glPushMatrix();//from w w w . j a v a2 s . com GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslated(x + .5, y - .5, z + .5); FMLClientHandler.instance().getClient().renderEngine .func_110577_a(new ResourceLocation(Config.MOD_ID.toLowerCase(), RenderingData.TEXTURE_WIRELESS)); this.model.renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:aroma1997.betterchests.client.BChestRenderer.java
License:Open Source License
public void renderTileEntityChestAt(TileEntityBChest par1TileEntityChest, double par2, double par4, double par6, float par8) { int i;/*from w ww .j a v a 2 s. com*/ if (!par1TileEntityChest.hasWorldObj()) { i = 0; } else { Block block = par1TileEntityChest.getBlockType(); i = par1TileEntityChest.getBlockMetadata(); if (block instanceof BlockChest && i == 0) { i = par1TileEntityChest.getBlockMetadata(); } } ModelChest modelchest = chestModel; bindTexture(model); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; if (i == 2) { short1 = 180; } if (i == 3) { short1 = 0; } if (i == 4) { short1 = 90; } if (i == 5) { short1 = -90; } GL11.glRotatef(short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F); modelchest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:aroma1997.betterchests.upgrades.Blocking.java
License:Open Source License
@Override @SideOnly(Side.CLIENT)/*from w w w .j a va 2 s. co m*/ public void draw(GuiContainer gui, ContainerBasic container, int par1, int par2, ItemStack item) { int blocked = item.stackSize * 9; GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.6F); GL11.glEnable(GL11.GL_BLEND); for (int i = 0; i < blocked; i++) { Slot slot = container.getSlot(i + 36); RenderHelper.renderTex(gui, Tex.REDCROSS, slot.xDisplayPosition - 1, slot.yDisplayPosition - 1); } GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:arrowsplus.client.render.RenderArrow.java
License:Open Source License
/** * Renders the arrow.// w w w . ja v a 2 s . co m * * @param entityArrow The arrow to render. * @param posX The x position to render the arrow at. * @param posY The y position to render the arrow at. * @param posZ The z position to render the arrow at. * @param yaw The yaw rotation to render the arrow with. * @param pitch The pitch to render the arrow with. */ public void renderArrow(EntityArrowBase entityArrow, double posX, double posY, double posZ, float yaw, float pitch) { this.func_110777_b(entityArrow); GL11.glPushMatrix(); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glRotatef(entityArrow.prevRotationYaw + (entityArrow.rotationYaw - entityArrow.prevRotationYaw) * pitch - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef( entityArrow.prevRotationPitch + (entityArrow.rotationPitch - entityArrow.prevRotationPitch) * pitch, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (0 + b0 * 10) / 32.0F; float f5 = (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (5 + b0 * 10) / 32.0F; float f9 = (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = entityArrow.arrowShake - pitch; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9); tessellator.draw(); for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:basedefense.client.renderer.item.surveillance.DNANeedleRenderer.java
License:Apache License
/** * Renders the needle model based on item attributes. * * @param itemStack The item stack./*from w w w.j a v a2 s . c o m*/ */ private void renderModel(ItemStack itemStack) { Minecraft.getMinecraft().renderEngine .bindTexture(new ResourceLocation("basedefense2", "textures/items/surveillance_dna_needle.png")); getModel().renderPart("Needle_Cube"); VialType vialType = DNANeedleItem.getVialType(itemStack); if (vialType == VialType.EMPTY || vialType == VialType.PLAYER || vialType == VialType.ENTITY) { GL11.glEnable(GL11.GL_BLEND); switch (vialType) { case PLAYER: Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation("basedefense2", "textures/items/surveillance_dna_needle_player.png")); break; case ENTITY: Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation("basedefense2", "textures/items/surveillance_dna_needle_mob.png")); break; } if (vialType != VialType.EMPTY) getModel().renderPart("Vial_Content_Cube.002"); Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation("basedefense2", "textures/items/surveillance_dna_needle.png")); getModel().renderPart("Vial_Cube.001"); GL11.glDisable(GL11.GL_BLEND); } }
From source file:betterfonts.StringCache.java
License:Open Source License
/** * Render a single-line string to the screen using the current OpenGL color. The (x,y) coordinates are of the uppet-left * corner of the string's bounding box, rather than the baseline position as is typical with fonts. This function will also * add the string to the cache so the next renderString() call with the same string is faster. * * @param str the string being rendered; it can contain color codes * @param x the x coordinate to draw at/*w w w .j a v a 2s .co m*/ * @param y the y coordinate to draw at * @param color the initial RGBA color to use when drawing the string; embedded color codes can override the RGB component * @param shadowFlag if true, color codes are replaces by a darker version used for drop shadows * @return the total advance (horizontal distance) of this string * * @todo Add optional NumericShaper to replace ASCII digits with locale specific ones * @todo Add support for the "k" code which randomly replaces letters on each render (used only by splash screen) * @todo Pre-sort by texture to minimize binds; can store colors per glyph in string cache * @todo Optimize the underline/strikethrough drawing to draw a single line for each run */ public int renderString(String str, int startX, int startY, int initialColor, boolean shadowFlag) { /* Check for invalid arguments */ if (str == null || str.isEmpty()) { return 0; } /* Make sure the entire string is cached before rendering and return its glyph representation */ Entry entry = cacheString(str); /* Adjust the baseline of the string because the startY coordinate in Minecraft is for the top of the string */ startY += BASELINE_OFFSET; /* Color currently selected by color code; reapplied to Tessellator instance after glBindTexture() */ int color = initialColor; /* Track which texture is currently bound to minimize the number of glBindTexture() and Tessellator.draw() calls needed */ int boundTextureName = 0; /* * This color change will have no effect on the actual text (since colors are included in the Tessellator vertex * array), however GuiEditSign of all things depends on having the current color set to white when it renders its * "Edit sign message:" text. Otherwise, the sign which is rendered underneath would look too dark. */ GL11.glColor3f(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff); /* * Enable GL_BLEND in case the font is drawn anti-aliased because Minecraft itself only enables blending for chat text * (so it can fade out), but not GUI text or signs. Minecraft uses multiple blend functions so it has to be specified here * as well for consistent blending. To reduce the overhead of OpenGL state changes and making native LWJGL calls, this * function doesn't try to save/restore the blending state. Hopefully everything else that depends on blending in Minecraft * will set its own state as needed. */ if (antiAliasEnabled) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } /* Using the Tessellator to queue up data in a vertex array and then draw all at once should be faster than immediate mode */ Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); /* The currently active font syle is needed to select the proper ASCII digit style for fast replacement */ int fontStyle = Font.PLAIN; for (int glyphIndex = 0, colorIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++) { /* * If the original string had a color code at this glyph's position, then change the current GL color that gets added * to the vertex array. Note that only the RGB component of the color is replaced by a color code; the alpha component * of the original color passed into this function will remain. The while loop handles multiple consecutive color codes, * in which case only the last such color code takes effect. */ while (colorIndex < entry.colors.length && entry.glyphs[glyphIndex].stringIndex >= entry.colors[colorIndex].stringIndex) { color = applyColorCode(entry.colors[colorIndex].colorCode, initialColor, shadowFlag); fontStyle = entry.colors[colorIndex].fontStyle; colorIndex++; } /* Select the current glyph's texture information and horizontal layout position within this string */ Glyph glyph = entry.glyphs[glyphIndex]; GlyphCache.Entry texture = glyph.texture; int glyphX = glyph.x; /* * Replace ASCII digits in the string with their respective glyphs; strings differing by digits are only cached once. * If the new replacement glyph has a different width than the original placeholder glyph (e.g. the '1' glyph is often * narrower than other digits), re-center the new glyph over the placeholder's position to minimize the visual impact * of the width mismatch. */ char c = str.charAt(glyph.stringIndex); if (c >= '0' && c <= '9') { int oldWidth = texture.width; texture = digitGlyphs[fontStyle][c - '0'].texture; int newWidth = texture.width; glyphX += (oldWidth - newWidth) >> 1; } /* * Make sure the OpenGL texture storing this glyph's image is bound (if not already bound). All pending glyphs in the * Tessellator's vertex array must be drawn before switching textures, otherwise they would erroneously use the new * texture as well. */ if (boundTextureName != texture.textureName) { tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.textureName); boundTextureName = texture.textureName; } /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ float x1 = startX + (glyphX) / 2.0F; float x2 = startX + (glyphX + texture.width) / 2.0F; float y1 = startY + (glyph.y) / 2.0F; float y2 = startY + (glyph.y + texture.height) / 2.0F; tessellator.addVertexWithUV(x1, y1, 0, texture.u1, texture.v1); tessellator.addVertexWithUV(x1, y2, 0, texture.u1, texture.v2); tessellator.addVertexWithUV(x2, y2, 0, texture.u2, texture.v2); tessellator.addVertexWithUV(x2, y1, 0, texture.u2, texture.v1); } /* Draw any remaining glyphs in the Tessellator's vertex array (there should be at least one glyph pending) */ tessellator.draw(); /* Draw strikethrough and underlines if the string uses them anywhere */ if (entry.specialRender) { int renderStyle = 0; /* Use initial color passed to renderString(); disable texturing to draw solid color lines */ color = initialColor; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); for (int glyphIndex = 0, colorIndex = 0; glyphIndex < entry.glyphs.length; glyphIndex++) { /* * If the original string had a color code at this glyph's position, then change the current GL color that gets added * to the vertex array. The while loop handles multiple consecutive color codes, in which case only the last such * color code takes effect. */ while (colorIndex < entry.colors.length && entry.glyphs[glyphIndex].stringIndex >= entry.colors[colorIndex].stringIndex) { color = applyColorCode(entry.colors[colorIndex].colorCode, initialColor, shadowFlag); renderStyle = entry.colors[colorIndex].renderStyle; colorIndex++; } /* Select the current glyph within this string for its layout position */ Glyph glyph = entry.glyphs[glyphIndex]; /* The strike/underlines are drawn beyond the glyph's width to include the extra space between glyphs */ int glyphSpace = glyph.advance - glyph.texture.width; /* Draw underline under glyph if the style is enabled */ if ((renderStyle & ColorCode.UNDERLINE) != 0) { /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ float x1 = startX + (glyph.x - glyphSpace) / 2.0F; float x2 = startX + (glyph.x + glyph.advance) / 2.0F; float y1 = startY + (UNDERLINE_OFFSET) / 2.0F; float y2 = startY + (UNDERLINE_OFFSET + UNDERLINE_THICKNESS) / 2.0F; tessellator.addVertex(x1, y1, 0); tessellator.addVertex(x1, y2, 0); tessellator.addVertex(x2, y2, 0); tessellator.addVertex(x2, y1, 0); } /* Draw strikethrough in the middle of glyph if the style is enabled */ if ((renderStyle & ColorCode.STRIKETHROUGH) != 0) { /* The divide by 2.0F is needed to align with the scaled GUI coordinate system; startX/startY are already scaled */ float x1 = startX + (glyph.x - glyphSpace) / 2.0F; float x2 = startX + (glyph.x + glyph.advance) / 2.0F; float y1 = startY + (STRIKETHROUGH_OFFSET) / 2.0F; float y2 = startY + (STRIKETHROUGH_OFFSET + STRIKETHROUGH_THICKNESS) / 2.0F; tessellator.addVertex(x1, y1, 0); tessellator.addVertex(x1, y2, 0); tessellator.addVertex(x2, y2, 0); tessellator.addVertex(x2, y1, 0); } } /* Finish drawing the last strikethrough/underline segments */ tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } /* Return total horizontal advance (slightly wider than the bounding box, but close enough for centering strings) */ return entry.advance / 2; }
From source file:blusunrize.immersiveengineering.client.render.TileRenderBottlingMachine.java
@Override public void render(TileEntityBottlingMachine te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (!te.formed || te.isDummy() || !te.getWorld().isBlockLoaded(te.getPos(), false)) return;/*from w w w . j a v a 2 s .c om*/ //Grab model + correct eextended state final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); BlockPos blockPos = te.getPos(); IBlockState state = getWorld().getBlockState(blockPos); if (state.getBlock() != IEContent.blockMetalMultiblock) return; state = state.getBlock().getActualState(state, getWorld(), blockPos); state = state.withProperty(IEProperties.DYNAMICRENDER, true); IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state); //Initialize Tesselator and BufferBuilder Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldRenderer = tessellator.getBuffer(); //Outer GL Wrapping, initial translation GlStateManager.pushMatrix(); GlStateManager.translate(x + .5, y + .5, z + .5); if (te.mirrored) GlStateManager.scale(te.facing.getXOffset() == 0 ? -1 : 1, 1, te.facing.getZOffset() == 0 ? -1 : 1); //Item Displacement float[][] itemDisplays = new float[te.bottlingProcessQueue.size()][]; //Animations float lift = 0; for (int i = 0; i < itemDisplays.length; i++) { BottlingProcess process = te.bottlingProcessQueue.get(i); if (process == null || process.processTick == process.maxProcessTick) continue; //+partialTicks float processTimer = ((float) process.processTick) / process.maxProcessTick * 120; float itemX = -1.5f;//-1; float itemY = -.15625f;// -.34375f; float itemZ = 1;//-.9375f; float itemFill = 0;//ClientUtils.mc().player.ticksExisted%100; //0f; if (processTimer <= 35)//slide { itemX += processTimer / 35f * 1.5; } else if (processTimer <= 85)//slide { itemX = 0; if (processTimer <= 55) lift = (processTimer - 35) / 20f * .125f; else if (processTimer <= 65) { lift = .125f; itemFill = (processTimer - 55) / 10f; } else { lift = (85 - processTimer) / 20f * .125f; itemFill = 1; } itemY += lift; lift += .0625; } else { itemX = (processTimer - 85) / 35f * 1.5f; itemFill = 1; } itemDisplays[i] = new float[] { processTimer, itemX, itemY, itemZ, itemFill }; } ClientUtils.bindAtlas(); GlStateManager.pushMatrix(); GlStateManager.translate(0, lift, 0); renderModelPart(blockRenderer, tessellator, worldRenderer, te.getWorld(), state, model, blockPos, "lift"); GlStateManager.translate(0, -lift, 0); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); switch (te.facing) { case NORTH: break; case SOUTH: GlStateManager.rotate(180, 0, 1, 0); break; case WEST: GlStateManager.rotate(90, 0, 1, 0); break; case EAST: GlStateManager.rotate(-90, 0, 1, 0); break; } float scale = .0625f; FluidStack fs = te.tanks[0].getFluid(); if (fs != null) { GlStateManager.pushMatrix(); float level = fs.amount / (float) te.tanks[0].getCapacity(); GlStateManager.translate(-.21875, .376, 1.21875); GlStateManager.scale(scale, scale, scale); float h = level * 9; ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, h); GlStateManager.rotate(90, 0, 1, 0); ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, h); GlStateManager.rotate(90, 0, 1, 0); GlStateManager.translate(-7, 0, 7); ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, h); GlStateManager.rotate(90, 0, 1, 0); ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, h); GlStateManager.rotate(90, 1, 0, 0); ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, 7); GlStateManager.translate(0, 0, -h); ClientUtils.drawRepeatedFluidSprite(fs, 0, 0, 7, 7); GlStateManager.scale(1 / scale, 1 / scale, 1 / scale); GlStateManager.translate(0, -1, -1); GlStateManager.popMatrix(); } //DRAW ITEMS HERE for (int i = 0; i < itemDisplays.length; i++) if (itemDisplays[i] != null) { BottlingProcess process = te.bottlingProcessQueue.get(i); if (process == null) continue; ItemStack display = itemDisplays[i][4] == 0 || process.items.get(1).isEmpty() ? process.items.get(0) : process.items.get(1); scale = .4375f; GlStateManager.translate(itemDisplays[i][1], itemDisplays[i][2], itemDisplays[i][3]); GlStateManager.scale(scale, scale, scale); if (itemDisplays[i][4] == 0) ClientUtils.mc().getRenderItem().renderItem(process.items.get(0), ItemCameraTransforms.TransformType.FIXED); else if (itemDisplays[i][4] == 1 || !ClientProxy.stencilBufferEnabled) ClientUtils.mc().getRenderItem().renderItem(display, ItemCameraTransforms.TransformType.FIXED); else { float h0 = -.5f; float h1 = h0 + itemDisplays[i][4]; BufferBuilder worldrenderer = tessellator.getBuffer(); //TODO move to GlStateManager if that ever gets the stencil functions GL11.glEnable(GL11.GL_STENCIL_TEST); GlStateManager.colorMask(false, false, false, false); GlStateManager.depthMask(false); GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF); GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilMask(0xFF); GlStateManager.clear(GL11.GL_STENCIL_BUFFER_BIT); GlStateManager.rotate(90.0F - ClientUtils.mc().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.disableTexture2D(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); ClientUtils.renderBox(worldrenderer, -.5, h0, -.5, .5, h1, .5); tessellator.draw(); GlStateManager.enableTexture2D(); GlStateManager.rotate(-(90.0F - ClientUtils.mc().getRenderManager().playerViewY), 0.0F, 1.0F, 0.0F); GlStateManager.colorMask(true, true, true, true); GlStateManager.depthMask(true); GL11.glStencilMask(0x00); GL11.glStencilFunc(GL11.GL_EQUAL, 0, 0xFF); ClientUtils.mc().getRenderItem().renderItem(process.items.get(0), ItemCameraTransforms.TransformType.FIXED); GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); ClientUtils.mc().getRenderItem().renderItem(display, ItemCameraTransforms.TransformType.FIXED); GL11.glDisable(GL11.GL_STENCIL_TEST); } GlStateManager.scale(1 / scale, 1 / scale, 1 / scale); GlStateManager.translate(-itemDisplays[i][1], -itemDisplays[i][2], -itemDisplays[i][3]); } GlStateManager.popMatrix(); }
From source file:boilerplate.client.fx.FXRaygun.java
License:Minecraft Mod Public
@Override public void renderParticle(final Tessellator tessellator, final float f, final float f1, final float f2, final float f3, final float f4, final float f5) { tessellator.draw();//from www . j av a2s . c om GL11.glPushMatrix(); final float var9 = 1.0F; final float slide = this.worldObj.getWorldTime(); final float rot = ((this.worldObj.provider.getWorldTime() % (360 / this.rotationspeed)) * this.rotationspeed) + (this.rotationspeed * f); float size = 0.5F; if (this.pulse) { size = Math.min(this.particleAge / 4.0F, 1.0F); size = this.prevSize + ((size - this.prevSize) * f); } float op = 0.4F; if ((this.pulse) && ((this.particleMaxAge - this.particleAge) <= 4)) { op = 0.4F - ((4 - (this.particleMaxAge - this.particleAge)) * 0.1F); } switch (this.type) { default: // In case I make another type of beam, I can change the beam // texture here break; case 1: // and here... break; case 2: ClientHelper.textureManager().bindTexture(rayTex); } GL11.glTexParameterf(3553, 10242, 10497.0F); GL11.glTexParameterf(3553, 10243, 10497.0F); GL11.glDisable(2884); float var11 = slide + f; if (this.reverse) { var11 *= -1.0F; // why name your variables "var11"? That is so // un-helpful } final float var12 = (-var11 * 0.2F) - MathHelper.floor_float(-var11 * 0.1F); GL11.glEnable(3042); GL11.glBlendFunc(770, 1); GL11.glDepthMask(false); double prex = this.player.prevPosX; double prey = this.player.prevPosY + this.offset; double prez = this.player.prevPosZ; double px = this.player.posX; double py = this.player.posY + this.offset; double pz = this.player.posZ; prex -= MathHelper.cos((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.066F; prey -= 0.06D; prez -= MathHelper.sin((this.player.prevRotationYaw / 180.0F) * 3.141593F) * 0.04F; Vec3 vec3d = this.player.getLook(1.0F); prex += vec3d.xCoord * 0.3D; prey += vec3d.yCoord * 0.3D; prez += vec3d.zCoord * 0.3D; px -= MathHelper.cos((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.066F; py -= 0.06D; pz -= MathHelper.sin((this.player.rotationYaw / 180.0F) * 3.141593F) * 0.04F; vec3d = this.player.getLook(1.0F); px += vec3d.xCoord * 0.3D; py += vec3d.yCoord * 0.3D; pz += vec3d.zCoord * 0.3D; final float xx = (float) ((prex + ((px - prex) * f)) - EntityFX.interpPosX); final float yy = (float) ((prey + ((py - prey) * f)) - EntityFX.interpPosY); final float zz = (float) ((prez + ((pz - prez) * f)) - EntityFX.interpPosZ); GL11.glTranslated(xx, yy, zz); final float ry = this.prevYaw + ((this.rotYaw - this.prevYaw) * f); final float rp = this.prevPitch + ((this.rotPitch - this.prevPitch) * f); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(180.0F + ry, 0.0F, 0.0F, -1.0F); GL11.glRotatef(rp, 1.0F, 0.0F, 0.0F); final double var44 = -0.15D * size; final double var17 = 0.15D * size; final double var44b = -0.15D * size * this.endMod; final double var17b = 0.15D * size * this.endMod; GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F); for (int t = 0; t < 5; t++) { final double var29 = this.length * size * var9; final double var31 = 0.0D; final double var33 = 1.0D; final double var35 = -1.0F + var12 + (t / 3.0F); final double var37 = (this.length * size * var9) + var35; GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.setBrightness(200); tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, op); tessellator.addVertexWithUV(var44b, var29, 0.0D, var33, var37); tessellator.addVertexWithUV(var44, 0.0D, 0.0D, var33, var35); tessellator.addVertexWithUV(var17, 0.0D, 0.0D, var31, var35); tessellator.addVertexWithUV(var17b, var29, 0.0D, var31, var37); tessellator.draw(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glEnable(2884); GL11.glPopMatrix(); tessellator.startDrawingQuads(); this.prevSize = size; }