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:cn.liutils.api.client.render.RenderIcon.java
License:Open Source License
@Override public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { GL11.glEnable(GL11.GL_BLEND);/* w w w .j a v a 2s.c om*/ GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_CULL_FACE); if (!enableDepth) GL11.glDisable(GL11.GL_DEPTH_TEST); if (!hasLight) GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glScalef(size, size, size); if (this.viewOptimize) { boolean firstPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView == 0; if (firstPerson) { GL11.glTranslated(fpOffsetX, fpOffsetY, fpOffsetZ); } else { GL11.glTranslated(tpOffsetX, tpOffsetY, tpOffsetZ); } } if (icon != null) RenderUtils.loadTexture(icon); Tessellator t = Tessellator.instance; this.func_77026_a(t); } GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.liutils.api.gui.LIGui.java
License:Open Source License
/** * Go down the hierarchy tree and draw each widget node. *//*from w w w . j av a 2 s .co m*/ public void draw(double mx, double my) { frameUpdate(); updateMouse(mx, my); iterating = true; GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDepthFunc(GL11.GL_ALWAYS); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(false); drawTraverse(mx, my, null, this, getTopNode(mx, my)); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); iterating = false; }
From source file:cn.liutils.cgui.gui.LIGui.java
License:Open Source License
/** * Go down the hierarchy tree and draw each widget node. *///from w ww . j a va 2 s. com public void draw(double mx, double my) { frameUpdate(); updateMouse(mx, my); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); drawTraverse(mx, my, null, this, getTopWidget(mx, my)); GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:cn.liutils.util.HudUtils.java
License:Open Source License
public static void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { float f = (par5 >> 24 & 255) / 255.0F; float f1 = (par5 >> 16 & 255) / 255.0F; float f2 = (par5 >> 8 & 255) / 255.0F; float f3 = (par5 & 255) / 255.0F; float f4 = (par6 >> 24 & 255) / 255.0F; float f5 = (par6 >> 16 & 255) / 255.0F; float f6 = (par6 >> 8 & 255) / 255.0F; float f7 = (par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D);/* w w w . ja v a2s. co m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator t = Tessellator.instance; t.startDrawingQuads(); t.setColorRGBA_F(f1, f2, f3, f); t.addVertex(par3, par2, -90D); t.addVertex(par1, par2, -90D); t.setColorRGBA_F(f5, f6, f7, f4); t.addVertex(par1, par4, -90D); t.addVertex(par3, par4, -90D); t.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:cn.liutils.util.RenderUtils.java
License:Open Source License
public static void renderOverlay_Equip(ResourceLocation src) { //Setup//from w w w . j ava2s .c o m GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); loadTexture(src); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glMatrixMode(GL11.GL_TEXTURE); //Push texture mat GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0 GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); //Second pass GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation! ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); //Pop texture mat GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.liutils.util.RenderUtils.java
License:Open Source License
public static void renderOverlay_Inv(ResourceLocation src) { GL11.glDepthFunc(GL11.GL_EQUAL);/* w ww.j a v a 2 s .c o m*/ GL11.glDisable(GL11.GL_LIGHTING); loadTexture(src); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; //GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); t.startDrawingQuads(); t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0); t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0); t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0); t.draw(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); t.startDrawingQuads(); t.addVertexWithUV(0.0, 0.0, 0.0, 0.0, 0.0); t.addVertexWithUV(0.0, 16.0, 0.0, 0.0, 1.0); t.addVertexWithUV(16.0, 16.0, 0.0, 1.0, 1.0); t.addVertexWithUV(16.0, 0.0, 0.0, 1.0, 0.0); t.draw(); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
From source file:cn.weaponmod.api.client.render.RenderBulletWeapon.java
License:Open Source License
public static void renderMuzzleflashIn2d(Tessellator t, String texture, double tx, double ty, double tz) { Vec3 a1 = RenderUtils.newV3(1.2, -0.4, -0.5), a2 = RenderUtils.newV3(1.2, 0.4, -0.5), a3 = RenderUtils.newV3(1.2, 0.4, 0.3), a4 = RenderUtils.newV3(1.2, -0.4, 0.3); float u1 = 0.0F, v1 = 0.0F, u2 = 1.0F, v2 = 1.0F; t = Tessellator.instance;/* w ww . ja va 2s . co m*/ GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(texture); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); GL11.glTranslated(tx, ty + 0.1F, tz + 0.1F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setColorRGBA_F(0.8F, .8F, .8F, 1.0F); t.setBrightness(15728880); addVertex(a1, u2, v2); addVertex(a2, u2, v1); addVertex(a3, u1, v1); addVertex(a4, u1, v2); t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.weaponmod.api.client.render.RendererBulletWeapon.java
License:Open Source License
public static void renderMuzzleflashIn2d(Tessellator t, ResourceLocation texture, double tx, double ty, double tz, float size) { Vec3 a1 = RenderUtils.newV3(1.2, -0.4, -0.5), a2 = RenderUtils.newV3(1.2, 0.4, -0.5), a3 = RenderUtils.newV3(1.2, 0.4, 0.3), a4 = RenderUtils.newV3(1.2, -0.4, 0.3); float u1 = 0.0F, v1 = 0.0F, u2 = 1.0F, v2 = 1.0F; t = Tessellator.instance;//w w w . j a v a 2s . c o m GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderUtils.loadTexture(texture); GL11.glRotatef(45, 0.0F, 0.0F, 1.0F); GL11.glTranslated(tx, ty + 0.1F, tz + 0.1F); GL11.glScalef(size, size, size); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f); t.startDrawingQuads(); t.setBrightness(15728880); addVertex(a1, u2, v2); addVertex(a2, u2, v1); addVertex(a3, u1, v1); addVertex(a4, u1, v2); t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:cn.weaponry.api.client.render.RendererWeapon.java
License:Open Source License
@Override public final void renderItem(ItemRenderType type, ItemStack item, Object... data) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; GL11.glEnable(GL11.GL_BLEND);//from w w w. j a v a 2 s. com GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED) { ItemInfo info = ItemInfoProxy.getInfo(player); RenderInfo ri = (RenderInfo) (info == null ? null : RenderInfo.get(info)); EntityLivingBase holder = (EntityLivingBase) data[1]; if (ri != null && holder == player) { handleHeldRender(ri, type == ItemRenderType.EQUIPPED_FIRST_PERSON); } else { handleSimpleRender(item); } } else { if (type == ItemRenderType.ENTITY) { handleEntityItemRender(item); } else { handleSimpleRender(item); } } }
From source file:cn.weaponry.impl.classic.client.animation.Muzzleflash.java
License:Open Source License
@Override public void render(ItemInfo info, PartedModel model, boolean firstPerson) { double alpha = 1.0; if (texture == null && textures != null) { texture = textures[RandUtils.nextInt(textures.length)]; }/* w w w . jav a 2s . c om*/ //Blend in long dt = getTime(); if (dt < 40) { alpha = dt / 40.0; } else if (dt > lifeTime - 40.0) { alpha = (lifeTime - dt) / 40.0; } GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glPushMatrix(); RenderUtils.loadTexture(texture == null ? MISSING : texture); GL11.glTranslated(x, y, z); material.setTexture(texture); GL11.glScaled(size, size, size); material.color.a = alpha * 0.8; GL11.glRotatef(90, 0, 1, 0); mesh.draw(material); GL11.glColor4d(1, 1, 1, 1); GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_CULL_FACE); }