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:org.yogpstop.qp.client.RenderRefinery.java
License:Open Source License
private void render(TileRefinery tile, double x, double y, double z) { FluidStack liquid1 = null, liquid2 = null, liquidResult = null; float anim = 0; int angle = 0; ModelRenderer theMagnet = this.magnet[0]; if (tile != null) { liquid1 = tile.src1;/*from w w w. java 2s. c o m*/ liquid2 = tile.src2; liquidResult = tile.res; anim = tile.getAnimationStage(); angle = 0; switch (tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) { case 2: angle = 90; break; case 3: angle = 270; break; case 4: angle = 180; break; case 5: angle = 0; break; } if (tile.animationSpeed <= 1) { theMagnet = this.magnet[0]; } else if (tile.animationSpeed <= 2.5) { theMagnet = this.magnet[1]; } else if (tile.animationSpeed <= 4.5) { theMagnet = this.magnet[2]; } else { theMagnet = this.magnet[3]; } } GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glRotatef(angle, 0, 1, 0); bindTexture(TEXTURE); GL11.glPushMatrix(); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-4F * pixel, 0, -4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, 4F * pixel); GL11.glTranslatef(-4F * pixel, 0, 4F * pixel); this.tank.render(pixel); GL11.glTranslatef(4F * pixel, 0, -4F * pixel); GL11.glTranslatef(4F * pixel, 0, 0); this.tank.render(pixel); GL11.glTranslatef(-4F * pixel, 0, 0); GL11.glPopMatrix(); float trans1, trans2; if (anim <= 100) { trans1 = 12F * pixel * anim / 100F; trans2 = 0; } else if (anim <= 200) { trans1 = 12F * pixel - (12F * pixel * (anim - 100F) / 100F); trans2 = 12F * pixel * (anim - 100F) / 100F; } else { trans1 = 12F * pixel * (anim - 200F) / 100F; trans2 = 12F * pixel - (12F * pixel * (anim - 200F) / 100F); } GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(0.99F, 0.99F, 0.99F); GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F); theMagnet.render(pixel); GL11.glPopMatrix(); if (tile != null) { 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(-0.5F, -0.5F, -0.5F); GL11.glScalef(0.5F, 1, 0.5F); if (liquid1 != null && liquid1.amount > 0) { int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.worldObj, false); if (list1 != null) { bindTexture(FluidRenderer.getFluidSheet(liquid1)); FluidRenderer.setColorForFluidStack(liquid1); GL11.glCallList( list1[(int) (liquid1.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); } } if (liquid2 != null && liquid2.amount > 0) { int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.worldObj, false); if (list2 != null) { GL11.glPushMatrix(); GL11.glTranslatef(0, 0, 1); bindTexture(FluidRenderer.getFluidSheet(liquid2)); FluidRenderer.setColorForFluidStack(liquid2); GL11.glCallList( list2[(int) (liquid2.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } } if (liquidResult != null && liquidResult.amount > 0) { int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.worldObj, false); if (list3 != null) { GL11.glPushMatrix(); GL11.glTranslatef(1, 0, 0.5F); bindTexture(FluidRenderer.getFluidSheet(liquidResult)); FluidRenderer.setColorForFluidStack(liquidResult); GL11.glCallList(list3[(int) (liquidResult.amount / (float) tile.buf * (FluidRenderer.DISPLAY_STAGES - 1))]); GL11.glPopMatrix(); } } GL11.glPopAttrib(); } GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:pixlepix.auracascade.lexicon.button.GuiButtonCategory.java
License:Creative Commons License
@Override public void drawButton(Minecraft mc, int mx, int my) { boolean inside = mx >= xPosition && my >= yPosition && mx < xPosition + width && my < yPosition + height; float time = 5F; if (inside)//from w ww . j ava 2 s .co m ticksHovered = Math.min(time, ticksHovered + gui.timeDelta); else ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta); /* Old code related to rendering categories from a texture instead of an ItemStack ResourceLocation resource; if (category == null) resource = fallbackResource; else resource = category.getIcon(); if (resource == null) resource = fallbackResource; mc.renderEngine.bindTexture(resource); */ //float s = 1F / 48F; float defAlpha = 0.3F; float alpha = ticksHovered / time * (1F - defAlpha) + defAlpha; GL11.glPushMatrix(); GL11.glColor4f(2F, 2F, 2F, alpha); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //GL11.glScalef(.5F, 3F, 3F); ItemStack itemStack; if (category == null) { itemStack = new ItemStack(Items.book); } else { itemStack = category.getIcon(); } GL11.glDisable(GL11.GL_LIGHTING); RenderItem.getInstance().renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), itemStack, xPosition, yPosition); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); if (inside) VazkiiRenderHelper.renderTooltipGreen(mx, my, Arrays.asList(StatCollector.translateToLocal(getTooltipText()))); }
From source file:pixlepix.auracascade.lexicon.GuiLexicon.java
License:Creative Commons License
@Override public void drawScreen(int par1, int par2, float par3) { float time = ClientTickHandler.ticksInGame + par3; timeDelta = time - lastTime;// www. j a va 2 s . com lastTime = time; partialTicks = par3; GL11.glColor4f(1F, 1F, 1F, 1F); mc.renderEngine.bindTexture(texture); drawTexturedModalRect(left, top, 0, 0, guiWidth, guiHeight); drawBookmark(left + guiWidth / 2, top - getTitleHeight(), getTitle(), true); String subtitle = getSubtitle(); if (subtitle != null) { GL11.glScalef(0.5F, 0.5F, 1F); drawCenteredString(fontRendererObj, subtitle, left * 2 + guiWidth, (top - getTitleHeight() + 11) * 2, 0x00FF00); GL11.glScalef(2F, 2F, 1F); } drawHeader(); if (bookmarksNeedPopulation) { populateBookmarks(); bookmarksNeedPopulation = false; } super.drawScreen(par1, par2, par3); if (hasTutorialArrow) { mc.renderEngine.bindTexture(texture); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 0.7F + (float) (Math.sin((ClientTickHandler.ticksInGame + par3) * 0.3F) + 1) * 0.15F); drawTexturedModalRect(tutorialArrowX, tutorialArrowY, 20, 200, TUTORIAL_ARROW_WIDTH, TUTORIAL_ARROW_HEIGHT); GL11.glDisable(GL11.GL_BLEND); } }
From source file:pixlepix.auracascade.lexicon.page.PageCraftingRecipe.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)//www . j a va 2 s. com public void renderRecipe(IGuiLexiconEntry gui, int mx, int my) { oreDictRecipe = shapelessRecipe = false; IRecipe recipe = recipes.get(recipeAt); renderCraftingRecipe(gui, recipe); TextureManager render = Minecraft.getMinecraft().renderEngine; render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); ((GuiScreen) gui).drawTexturedModalRect(gui.getLeft(), gui.getTop(), 0, 0, gui.getWidth(), gui.getHeight()); int iconX = gui.getLeft() + 115; int iconY = gui.getTop() + 12; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (shapelessRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 0, 16, 16); if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) VazkiiRenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("auramisc.shapeless"))); iconY += 20; } render.bindTexture(craftingOverlay); GL11.glEnable(GL11.GL_BLEND); if (oreDictRecipe) { ((GuiScreen) gui).drawTexturedModalRect(iconX, iconY, 240, 16, 16, 16); if (mx >= iconX && my >= iconY && mx < iconX + 16 && my < iconY + 16) VazkiiRenderHelper.renderTooltip(mx, my, Arrays.asList(StatCollector.translateToLocal("auramisc.oredict"))); } GL11.glDisable(GL11.GL_BLEND); }
From source file:pixlepix.auracascade.lexicon.page.PageImage.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)/* w w w . j a v a 2s .c o m*/ public void renderScreen(IGuiLexiconEntry gui, int mx, int my) { TextureManager render = Minecraft.getMinecraft().renderEngine; render.bindTexture(resource); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glTranslated(gui.getLeft() + gui.getWidth() / 8, gui.getTop() + gui.getHeight() / 8, 0); GL11.glScaled(.5, .5, .5); ((GuiScreen) gui).drawTexturedModalRect(0, 0, 0, 0, (int) (gui.getWidth() * 1.5) + 5, (int) (gui.getHeight() * 1.5) - 15); GL11.glDisable(GL11.GL_BLEND); int width = gui.getWidth() - 30; int height = gui.getHeight(); int x = gui.getLeft() + 16; int y = gui.getTop() + height - 40; //PageText.renderText(x, y, width, height, getUnlocalizedName()); }
From source file:processing.lwjgl.PGL.java
License:Open Source License
public void blendFunc(int srcFactor, int dstFactor) { GL11.glBlendFunc(srcFactor, dstFactor); }
From source file:processing.lwjgl.PLWJGL.java
License:Open Source License
public void blendFunc(int src, int dst) { GL11.glBlendFunc(src, dst); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void blendFunc(int src, int dst) { GL11.glBlendFunc(src, dst); }
From source file:rainet.Game.java
private void initGL(int width, int height, String title) { try {//from ww w .j av a 2s.c om Display.setDisplayMode(new DisplayMode(width, height)); Display.setLocation(6, 7); Display.setTitle(title); Display.create(); Display.setVSyncEnabled(true); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 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); }