List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:dracocore.handbook.pages.PageRecipe.java
License:Creative Commons License
@SideOnly(Side.CLIENT) public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) { RenderItem render = new RenderItem(); boolean mouseDown = Mouse.isButtonDown(0); GL11.glPushMatrix();//from ww w. ja v a 2s .co m GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_DEPTH_TEST); render.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), stack, xPos, yPos); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); if (relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) { tooltipStack = stack; LexiconRecipeMappings.EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack); if (data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) { tooltipEntry = true; if (!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) { GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui); newGui.page = data.page; Minecraft.getMinecraft().displayGuiScreen(newGui); } } else tooltipEntry = false; if (accountForContainer) { ItemStack containerStack = stack.getItem().getContainerItem(stack); if (containerStack != null && containerStack.getItem() != null) tooltipContainerStack = containerStack; } } GL11.glDisable(GL11.GL_LIGHTING); }
From source file:dripdisplay.DripDisplayLWJGL.java
private void initTextures() { // enable alpha blending 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); levelmap = new TextureMapper(); levelmap.initSheet( this.getClass().getResource("/dripimages/cavebackground_6level_spritesheet_4_12_2014.png"), "PNG"); levelmap.addSpriteLocation("cavebackground", new Rectangle2D.Float(.439f, .2944f, .219f, .294f)); levelmap.addSpriteLocation("caveforeground", new Rectangle2D.Float(.66f, 0f, .219f, .294f)); levelmap.addSpriteLocation("cavebackgrounddark", new Rectangle2D.Float(0f, .608f, .219f, .294f)); levelmap.addSpriteLocation("icebackground", new Rectangle2D.Float(.439f, 0f, .219f, .294f)); levelmap.addSpriteLocation("halficebackground", new Rectangle2D.Float(.22f, .607f, .219f, .294f)); levelmap.addSpriteLocation("largebackground", new Rectangle2D.Float(.01f, .01f, .428f, .595f)); levelmap.addSpriteLocation("shade", new Rectangle2D.Float(.11f, .63f, .1f, .05f)); levelmap.addSpriteLocation("empty", new Rectangle2D.Float(.667f, 0.63f, .1f, .1f)); playermap = new TextureMapper(); playermap.initSheet(this.getClass().getResource("/dripimages/drip_spritesheet_11_11_2014.png"), "PNG"); playermap.addSpriteLocation("drippyL", new Rectangle2D.Float(0f, .5f, .25f, .5f)); playermap.addSpriteLocation("drippyR", new Rectangle2D.Float(.25f, .5f, .25f, .5f)); playermap.addSpriteLocation("icey", new Rectangle2D.Float(.5f, 0f, .25f, .5f)); playermap.addSpriteLocation("cloudyL", new Rectangle2D.Float(0f, 0f, .25f, .5f)); playermap.addSpriteLocation("cloudyR", new Rectangle2D.Float(.25f, 0f, .25f, .5f)); scenerymap = new TextureMapper(); scenerymap.initSheet(this.getClass().getResource("/dripimages/scenery_spritesheet_4_12_2014.png"), "PNG"); scenerymap.addSpriteLocation("mossflat", new Rectangle2D.Float(0f, 0f, .298f, .064f)); scenerymap.addSpriteLocation("mosscurve", new Rectangle2D.Float(0f, .0643f, .298f, .064f)); scenerymap.addSpriteLocation("platform", new Rectangle2D.Float(.001f, .13f, .297f, .049f)); scenerymap.addSpriteLocation("iceplatform", new Rectangle2D.Float(0f, .18f, .3f, .025f)); scenerymap.addSpriteLocation("fatplatform", new Rectangle2D.Float(0f, .205f, .295f, .075f)); scenerymap.addSpriteLocation("largestalactite", new Rectangle2D.Float(0f, 0.2932f, .29f, .5198f)); scenerymap.addSpriteLocation("largestalagmite", new Rectangle2D.Float(.3f, 0f, .285f, .515f)); scenerymap.addSpriteLocation("smallstalagmite", new Rectangle2D.Float(.267f, .518f, .238f, .33f)); scenerymap.addSpriteLocation("smallstalactite", new Rectangle2D.Float(.585f, 0f, .238f, .33f)); scenerymap.addSpriteLocation("squareplatform", new Rectangle2D.Float(.588f, .331f, .195f, .195f)); scenerymap.addSpriteLocation("leftmoss", new Rectangle2D.Float(.5f, .5275f, .181f, .064f)); scenerymap.addSpriteLocation("rightmoss", new Rectangle2D.Float(.5f, .5917f, .181f, .0643f)); treemap = new TextureMapper(); treemap.initSheet(this.getClass().getResource("/dripimages/moredecoration_spritesheet_3_12_2014.png"), "PNG"); treemap.addSpriteLocation("tree1", new Rectangle2D.Float(.932f, 0f, .07f, .2f)); treemap.addSpriteLocation("tree2", new Rectangle2D.Float(.327f, 0f, .213f, .543f)); treemap.addSpriteLocation("tree3", new Rectangle2D.Float(0f, 0f, .3255f, .99f)); treemap.addSpriteLocation("root", new Rectangle2D.Float(.737f, .575f, .027f, .3f)); interactivemap = new TextureMapper(); interactivemap.initSheet(this.getClass().getResource("/dripimages/interactive_spritesheet_22_11_2014.png"), "PNG"); interactivemap.addSpriteLocation("iceright", new Rectangle2D.Float(0f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("rockright", new Rectangle2D.Float(.1325f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("iceleft", new Rectangle2D.Float(.265f, 0f, .1325f, .85f)); interactivemap.addSpriteLocation("rockleft", new Rectangle2D.Float(.3975f, 0f, .1325f, .85f)); decorationmap = new TextureMapper(); decorationmap.initSheet(this.getClass().getResource("/dripimages/decoration_spritesheet_18_11_2014.png"), "PNG"); decorationmap.addSpriteLocation("grass", new Rectangle2D.Float(0f, 0f, .582f, .0445f)); decorationmap.addSpriteLocation("shroom1", new Rectangle2D.Float(0f, .05f, .205f, .162f)); decorationmap.addSpriteLocation("shroom2", new Rectangle2D.Float(0f, .212f, .205f, .162f)); decorationmap.addSpriteLocation("shroom3", new Rectangle2D.Float(.205f, .0483f, .21f, .165f)); decorationmap.addSpriteLocation("shroom4", new Rectangle2D.Float(.205f, .216f, .21f, .165f)); decorationmap.addSpriteLocation("grass1", new Rectangle2D.Float(.415f, .05f, .153f, .37f)); decorationmap.addSpriteLocation("grass2", new Rectangle2D.Float(.588f, 0f, .153f, .37f)); decorationmap.addSpriteLocation("grass3", new Rectangle2D.Float(.75f, 0f, .153f, .37f)); decorationmap.addSpriteLocation("grass4", new Rectangle2D.Float(0f, .375f, .1512f, .37f)); decorationmap.addSpriteLocation("shroom", new Rectangle2D.Float(.153f, .375f, .1506f, .162f)); threatmap = new TextureMapper(); threatmap.initSheet(this.getClass().getResource("/dripimages/fireice_spritesheet_16_11_2014.png"), "PNG"); threatmap.addSpriteLocation("fire1", new Rectangle2D.Float(.00f, 0f, .155f, .403f)); threatmap.addSpriteLocation("fire2", new Rectangle2D.Float(.156f, 0f, .155f, .403f)); threatmap.addSpriteLocation("fire3", new Rectangle2D.Float(.312f, 0f, .154f, .403f)); threatmap.addSpriteLocation("ice1", new Rectangle2D.Float(.47f, 0f, .15f, .41f)); threatmap.addSpriteLocation("ice2", new Rectangle2D.Float(.0f, .4f, .15f, .41f)); threatmap.addSpriteLocation("ice3", new Rectangle2D.Float(.1f, .4f, .15f, .41f)); healingmap = new TextureMapper(); healingmap.initSheet(this.getClass().getResource("/dripimages/pooldrip_spritesheet_16_11_2014.png"), "PNG"); healingmap.addSpriteLocation("pool1", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool2", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool3", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool4", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("pool5", new Rectangle2D.Float(0f, 0f, .39f, .085f)); healingmap.addSpriteLocation("drop1", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop2", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop3", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop4", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop5", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop6", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healingmap.addSpriteLocation("drop7", new Rectangle2D.Float(.0f, 0f, .15f, .1f)); healthmap = new TextureMapper(); healthmap.initSheet(this.getClass().getResource("/dripimages/waterhealth_spritesheet_11_11_2014.png"), "PNG"); healthmap.addSpriteLocation("10", new Rectangle2D.Float(0f, 0f, .25f, .25f)); healthmap.addSpriteLocation("20", new Rectangle2D.Float(0f, .25f, .25f, .25f)); healthmap.addSpriteLocation("30", new Rectangle2D.Float(.25f, .25f, .25f, .25f)); healthmap.addSpriteLocation("40", new Rectangle2D.Float(.5f, 0f, .25f, .25f)); healthmap.addSpriteLocation("50", new Rectangle2D.Float(.5f, .25f, .25f, .25f)); healthmap.addSpriteLocation("60", new Rectangle2D.Float(.75f, 0f, .25f, .25f)); healthmap.addSpriteLocation("70", new Rectangle2D.Float(.75f, .25f, .25f, .25f)); healthmap.addSpriteLocation("80", new Rectangle2D.Float(0f, .5f, .25f, .25f)); healthmap.addSpriteLocation("90", new Rectangle2D.Float(0f, .75f, .25f, .25f)); healthmap.addSpriteLocation("100", new Rectangle2D.Float(.25f, 0f, .25f, .25f)); healthmap.addSpriteLocation("0", new Rectangle2D.Float(.9f, .9f, .01f, .01f)); healthmap.addSpriteLocation("porthole", new Rectangle2D.Float(.25f, .5f, .25f, .25f)); numbermap = new TextureMapper(); numbermap.initSheet(this.getClass().getResource("/dripimages/number_spritesheet_11_11_2014.png"), "PNG"); numbermap.addSpriteLocation("0", new Rectangle2D.Float(0f, 0f, .2f, .2f)); numbermap.addSpriteLocation("1", new Rectangle2D.Float(.21f, 0f, .2f, .2f)); numbermap.addSpriteLocation("2", new Rectangle2D.Float(.42f, 0f, .2f, .2f)); numbermap.addSpriteLocation("3", new Rectangle2D.Float(.63f, 0f, .2f, .2f)); numbermap.addSpriteLocation("4", new Rectangle2D.Float(0f, .206f, .2f, .2f)); numbermap.addSpriteLocation("5", new Rectangle2D.Float(.21f, .206f, .2f, .2f)); numbermap.addSpriteLocation("6", new Rectangle2D.Float(.42f, .206f, .2f, .206f)); numbermap.addSpriteLocation("7", new Rectangle2D.Float(.63f, .206f, .2f, .206f)); numbermap.addSpriteLocation("8", new Rectangle2D.Float(0f, .41f, .2f, .206f)); numbermap.addSpriteLocation("9", new Rectangle2D.Float(.21f, .41f, .2f, .206f)); numbermap.addSpriteLocation("blank", new Rectangle2D.Float(.63f, .41f, .2f, .206f)); temperaturemap = new TextureMapper(); temperaturemap.initSheet(this.getClass().getResource("/dripimages/temperature_spritesheet_17_11_2014.png"), "PNG"); temperaturemap.addSpriteLocation("temp10", new Rectangle2D.Float(0f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp20", new Rectangle2D.Float(.18f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp30", new Rectangle2D.Float(.36f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp40", new Rectangle2D.Float(.54f, 0f, .18f, .28f)); temperaturemap.addSpriteLocation("temp50", new Rectangle2D.Float(0f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp60", new Rectangle2D.Float(.18f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp70", new Rectangle2D.Float(.36f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp80", new Rectangle2D.Float(.54f, .288f, .18f, .28f)); temperaturemap.addSpriteLocation("temp90", new Rectangle2D.Float(0f, .576f, .18f, .28f)); menumap = new TextureMapper(); menumap.initSheet(this.getClass().getResource("/dripimages/menu_spritesheet_1_12_2014.png"), "PNG"); menumap.addSpriteLocation("levelcomplete", new Rectangle2D.Float(0f, 0f, .5f, .15f)); menumap.addSpriteLocation("darken", new Rectangle2D.Float(0f, .2f, .1f, .1f)); menumap.addSpriteLocation("paused", new Rectangle2D.Float(0f, .44f, .39f, .27f)); menumap.addSpriteLocation("pressspacedark", new Rectangle2D.Float(0f, .715f, .35f, .0618f)); menumap.addSpriteLocation("pressspacelight", new Rectangle2D.Float(0f, .78f, .35f, .0601f)); menumap.addSpriteLocation("optionsdark", new Rectangle2D.Float(0f, .84f, .17f, .12f)); menumap.addSpriteLocation("optionslight", new Rectangle2D.Float(0.17f, 0.84f, .17f, .12f)); menumap.addSpriteLocation("quitlight", new Rectangle2D.Float(0.64f, .695f, .09f, .13f)); menumap.addSpriteLocation("quitdark", new Rectangle2D.Float(0.5f, 0f, .09f, .13f)); menumap.addSpriteLocation("d", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("r", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("drip", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("i", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); menumap.addSpriteLocation("p", new Rectangle2D.Float(0.39f, 0f, .39f, 1f)); leveleditormap = new TextureMapper(); leveleditormap.initSheet(this.getClass().getResource("/dripimages/leveleditor_spritesheet_22_11_2014.png"), "PNG"); leveleditormap.addSpriteLocation("bottombar", new Rectangle2D.Float(0f, 0f, .78f, .195f)); leveleditormap.addSpriteLocation("sidebar", new Rectangle2D.Float(0f, .195f, .195f, .78f)); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:dynamicswordskills.client.RenderEntitySwordBeam.java
License:Open Source License
public void renderBeam(Entity entity, double x, double y, double z, float yaw, float partialTick) { GL11.glPushMatrix();/*w w w . j av a 2 s . c o m*/ GL11.glTranslated(x, y, z); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glScalef(1.5F, 1.25F, 1.5F); bindTexture(texture); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer renderer = tessellator.getWorldRenderer(); GL11.glRotatef(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F); renderer.startDrawingQuads(); renderer.setNormal(0.0F, 1.0F, 0.0F); renderer.addVertexWithUV(-0.5D, -0.25D, 0.0D, 0, 1); renderer.addVertexWithUV(0.5D, -0.25D, 0.0D, 1, 1); renderer.addVertexWithUV(0.5D, 0.75D, 0.0D, 1, 0); renderer.addVertexWithUV(-0.5D, 0.75D, 0.0D, 0, 0); tessellator.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:edu.csun.ecs.cs.multitouchj.ui.control.FramedControl.java
License:Apache License
public void render() { // render with no texture Texture texture = getTexture();/*w w w .ja v a 2s .co m*/ setTexture((Texture) null); GL11.glPushMatrix(); GL11.glLoadIdentity(); super.render(); GL11.glPopMatrix(); setTexture(texture); // rendering texture if ((!isVisible()) || (texture == null)) { return; } Size controlSize = getSize(); Size imageSize = texture.getImage().getSize(); float margin = getMargin(); if ((margin >= controlSize.getWidth()) || (margin >= controlSize.getHeight())) { margin = 0.0f; } Color color = getColor(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(((float) color.getRed() / 255.0f), ((float) color.getGreen() / 255.0f), ((float) color.getBlue() / 255.0f), getOpacity()); Point position = getOpenGlPosition(); float halfWidth = (controlSize.getWidth() / 2.0f); float halfHeight = (controlSize.getHeight() / 2.0f); GL11.glTranslatef(position.getX(), position.getY(), 0.0f); float rotation = OpenGlUtility.getOpenGlRotation(getRotation()); GL11.glRotatef(rotation, 0.0f, 0.0f, 1.0f); // render texture GL11.glEnable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); GL11.glBindTexture(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT, texture.getId().intValue()); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(((-1 * halfWidth) + margin), ((-1 * halfHeight) + margin), 0.0f); GL11.glTexCoord2f(imageSize.getWidth(), 0.0f); GL11.glVertex3f((halfWidth - margin), ((-1 * halfHeight) + margin), 0.0f); GL11.glTexCoord2f(imageSize.getWidth(), imageSize.getHeight()); GL11.glVertex3f((halfWidth - margin), (halfHeight - margin), 0.0f); GL11.glTexCoord2f(0.0f, imageSize.getHeight()); GL11.glVertex3f(((-1 * halfWidth) + margin), (halfHeight - margin), 0.0f); GL11.glEnd(); }
From source file:edu.csun.ecs.cs.multitouchj.ui.control.TexturedControl.java
License:Apache License
public void render() { if (!isVisible()) { return;/* ww w.j av a2 s . c o m*/ } Size controlSize = getSize(); Size imageSize = null; if (texture != null) { imageSize = texture.getImage().getSize(); } Color color = getColor(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(((float) color.getRed() / 255.0f), ((float) color.getGreen() / 255.0f), ((float) color.getBlue() / 255.0f), getOpacity()); Point position = getOpenGlPosition(); float halfWidth = (controlSize.getWidth() / 2.0f); float halfHeight = (controlSize.getHeight() / 2.0f); GL11.glTranslatef(position.getX(), position.getY(), 0.0f); float rotation = OpenGlUtility.getOpenGlRotation(getRotation()); GL11.glRotatef(rotation, 0.0f, 0.0f, 1.0f); if (texture != null) { GL11.glEnable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); GL11.glBindTexture(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT, texture.getId().intValue()); } else { GL11.glDisable(EXTTextureRectangle.GL_TEXTURE_RECTANGLE_EXT); } // bl -> br -> tr -> tl GL11.glBegin(GL11.GL_QUADS); if (texture != null) { GL11.glTexCoord2f(0.0f, 0.0f); } GL11.glVertex3f((-1 * halfWidth), (-1 * halfHeight), 0.0f); if (texture != null) { GL11.glTexCoord2f(imageSize.getWidth(), 0.0f); } GL11.glVertex3f(halfWidth, (-1 * halfHeight), 0.0f); if (texture != null) { GL11.glTexCoord2f(imageSize.getWidth(), imageSize.getHeight()); } GL11.glVertex3f(halfWidth, halfHeight, 0.0f); if (texture != null) { GL11.glTexCoord2f(0.0f, imageSize.getHeight()); } GL11.glVertex3f((-1 * halfWidth), halfHeight, 0.0f); GL11.glEnd(); }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
/** * Renders a dropped item// w w w .ja va 2 s . com */ private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) { par2Icon = this.renderManager.renderEngine .getMissingIcon(par1EntityItem.getEntityItem().getItemSpriteNumber()); } float f4 = par2Icon.getMinU(); float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); float f8 = 1.0F; float f9 = 0.5F; float f10 = 0.25F; float f11; GL11.glPushMatrix(); if (renderInFrame) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } else { GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); } float f12 = 0.0625F; f11 = 0.021875F; ItemStack itemstack = par1EntityItem.getEntityItem(); int j = itemstack.stackSize; byte b0 = getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { GL11.glTranslatef(0.0F, 0.0F, f12 + f11); // Makes items offset when in 3D, like when in 2D, looks much // better. Considered a vanilla bug... if (k > 0 && shouldSpreadItems()) { float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; GL11.glTranslatef(x, y, f12 + f11); } else { GL11.glTranslatef(0f, 0f, f12 + f11); } if (itemstack.getItemSpriteNumber() == 0) { this.loadTexture("/terrain.png"); } else { this.loadTexture("/gui/items.png"); } GL11.glColor4f(par5, par6, par7, 1.0F); ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12); if (itemstack != null && itemstack.hasEffect()) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
/** * Render the item's icon or block into the GUI, including the glint effect. *///from ww w . j a v a 2 s. c om public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { if (par3ItemStack != null) { if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5)) { this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); } if (par3ItemStack.hasEffect()) { GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); par2RenderEngine.bindTexture("%blur%/misc/glint.png"); this.zLevel -= 50.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); this.zLevel += 50.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
private void renderGlint(int par1, int par2, int par3, int par4, int par5) { for (int j1 = 0; j1 < 2; ++j1) { if (j1 == 0) { GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); }// ww w . j ava 2 s . c o m if (j1 == 1) { GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); } float f = 0.00390625F; float f1 = 0.00390625F; float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F; float f3 = 0.0F; Tessellator tessellator = Tessellator.instance; float f4 = 4.0F; if (j1 == 1) { f4 = -1.0F; } tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1)); tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1)); tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1)); tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1)); tessellator.draw(); } }
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
public void initBlendedRendering() { GL11.glDepthMask(false);//from ww w. ja va2 s .co m GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glEnable(GL11.GL_BLEND); // Enable Blending GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); // Type Of Blending To Perform // GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST); // Really Nice Point Smoothing }
From source file:eu.over9000.veya.gui.Gui.java
License:Open Source License
private static void setUpStates(final int width, final int height) { try {/*from ww w.j a va 2s. c om*/ Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); //Display.create(new PixelFormat().withSamples(4).withDepthBits(24), new ContextAttribs(3, 3)); Display.setVSyncEnabled(true); } catch (final LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.3f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }