@Override public void doRender(Entity entity, double x, double y, double z, float a, float b) { EntityRippleMark mark = (EntityRippleMark) entity; long dt = GameTimer.getTime() - mark.creationTime; GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glDepthMask(false); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); for (int i = 0; i < timeOffsets.length; ++i) { GL11.glPushMatrix(); long mod = (dt - timeOffsets[i]) % CYCLE; float size = getSize(mod); GL11.glTranslatef(0, getHeight(mod), 0); GL11.glScalef(size, 1, size); material.color = mark.color.copy(); material.color.a *= getAlpha(mod); mesh.draw(material); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); }
public void renderParticle( Tessellator tess, float ptt, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { brightness = brightnessFade.updateFade(particleAge); float progress = (float) particleAge / particleMaxAge; // tess.draw(); // glPushMatrix(); glDepthMask(false); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); Minecraft.getMinecraft().renderEngine.bindTexture(tex); float scale = data.size; float[] pos = FXHelper.trackingParticleLocale(this, ptt); float[] rot = new float[] {rotX, rotXZ, rotZ, rotYZ, rotXY}; pos[0] += data.xRad * Math.cos(2 * Math.PI * progress); pos[1] += 0.5 * data.yRad * Math.cos(2 * Math.PI * progress) * Math.sin(2 * Math.PI * progress); pos[2] += data.zRad * Math.sin(2 * Math.PI * progress); draw(tess, pos, scale, rot); glDisable(GL_BLEND); glDepthMask(true); // glPopMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(FXHelper.getParticleTexture()); // tess.startDrawingQuads(); }
/** R_DrawBeam */ void R_DrawBeam(entity_t e) { oldorigin[0] = e.oldorigin[0]; oldorigin[1] = e.oldorigin[1]; oldorigin[2] = e.oldorigin[2]; origin[0] = e.origin[0]; origin[1] = e.origin[1]; origin[2] = e.origin[2]; normalized_direction[0] = direction[0] = oldorigin[0] - origin[0]; normalized_direction[1] = direction[1] = oldorigin[1] - origin[1]; normalized_direction[2] = direction[2] = oldorigin[2] - origin[2]; if (Math3D.VectorNormalize(normalized_direction) == 0.0f) return; Math3D.PerpendicularVector(perpvec, normalized_direction); Math3D.VectorScale(perpvec, e.frame / 2, perpvec); for (int i = 0; i < 6; i++) { Math3D.RotatePointAroundVector( start_points[i], normalized_direction, perpvec, (360.0f / NUM_BEAM_SEGS) * i); Math3D.VectorAdd(start_points[i], origin, start_points[i]); Math3D.VectorAdd(start_points[i], direction, end_points[i]); } GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); float r = (d_8to24table[e.skinnum & 0xFF]) & 0xFF; float g = (d_8to24table[e.skinnum & 0xFF] >> 8) & 0xFF; float b = (d_8to24table[e.skinnum & 0xFF] >> 16) & 0xFF; r *= 1 / 255.0f; g *= 1 / 255.0f; b *= 1 / 255.0f; GL11.glColor4f(r, g, b, e.alpha); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); float[] v; for (int i = 0; i < NUM_BEAM_SEGS; i++) { v = start_points[i]; GL11.glVertex3f(v[0], v[1], v[2]); v = end_points[i]; GL11.glVertex3f(v[0], v[1], v[2]); v = start_points[(i + 1) % NUM_BEAM_SEGS]; GL11.glVertex3f(v[0], v[1], v[2]); v = end_points[(i + 1) % NUM_BEAM_SEGS]; GL11.glVertex3f(v[0], v[1], v[2]); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }
private void renderOverlay( TileAnimationTablet tablet, ResourceLocation texture, int rotationMod, boolean useLighting, boolean useBlend, double size, float height, float forceDeg) { Minecraft mc = ClientHelper.minecraft(); mc.renderEngine.bindTexture(texture); GL11.glPushMatrix(); GL11.glDepthMask(false); if (!useLighting) GL11.glDisable(GL11.GL_LIGHTING); if (useBlend) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); } GL11.glTranslatef(0.5F, height, 0.5F); float deg = rotationMod == 0 ? forceDeg : (float) (tablet.ticksExisted * rotationMod % 360F); GL11.glRotatef(deg, 0F, 1F, 0F); GL11.glColor4f(1F, 1F, 1F, 1F); Tessellator tess = Tessellator.instance; double size1 = size / 2; double size2 = -size1; tess.startDrawingQuads(); tess.addVertexWithUV(size2, 0, size1, 0, 1); tess.addVertexWithUV(size1, 0, size1, 1, 1); tess.addVertexWithUV(size1, 0, size2, 1, 0); tess.addVertexWithUV(size2, 0, size2, 0, 0); tess.draw(); GL11.glDepthMask(true); if (!useLighting) GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
/** R_DrawParticles */ void R_DrawParticles() { if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) { // GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glVertexPointer(3, 0, particle_t.vertexArray); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer()); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glPointSize(gl_particle_size.value); GL11.glDrawArrays(GL11.GL_POINTS, 0, r_newrefdef.num_particles); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); // GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); } else { GL_DrawParticles(r_newrefdef.num_particles); } }
protected int func_77074_a(EntityEnderman p_77074_1_, int p_77074_2_, float p_77074_3_) { if (p_77074_2_ != 0) { return -1; } else { this.func_76985_a("/mob/enderman_eyes.png"); float var4 = 1.0F; GL11.glEnable(3042); GL11.glDisable(3008); GL11.glBlendFunc(1, 1); GL11.glDisable(2896); if (p_77074_1_.func_82150_aj()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char var5 = '\uf0f0'; int var6 = var5 % 65536; int var7 = var5 / 65536; OpenGlHelper.func_77475_a( OpenGlHelper.field_77476_b, (float) var6 / 1.0F, (float) var7 / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(2896); GL11.glColor4f(1.0F, 1.0F, 1.0F, var4); return 1; } }
/** Sets the spider's glowing eyes */ protected int setSpiderEyeBrightness(EntitySpider par1EntitySpider, int par2, float par3) { if (par2 != 0) { return -1; } else { this.loadTexture("/mob/spider_eyes.png"); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); if (par1EntitySpider.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); return 1; } }
private void renderPortalOverlay(float f, int i, int j) { if (f < 1.0F) { f *= f; f *= f; f = f * 0.8F + 0.2F; } GL11.glDisable(3008 /*GL_ALPHA_TEST*/); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); GL11.glBlendFunc(770, 771); GL11.glColor4f(1.0F, 1.0F, 1.0F, f); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png")); float f1 = (float) (Block.portal.blockIndexInTexture % 16) / 16F; float f2 = (float) (Block.portal.blockIndexInTexture / 16) / 16F; float f3 = (float) (Block.portal.blockIndexInTexture % 16 + 1) / 16F; float f4 = (float) (Block.portal.blockIndexInTexture / 16 + 1) / 16F; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, j, -90D, f1, f4); tessellator.addVertexWithUV(i, j, -90D, f3, f4); tessellator.addVertexWithUV(i, 0.0D, -90D, f3, f2); tessellator.addVertexWithUV(0.0D, 0.0D, -90D, f1, f2); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
/** Render the EvolvedEndermans eyes */ protected int renderEyes( SCSednaEntityEvolvedEnderman par1EntityEvolvedEnderman, int par2, float par3) { if (par2 != 0) { return -1; } else { this.bindTexture(EvolvedEndermanEyesTexture); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDisable(GL11.GL_LIGHTING); if (par1EntityEvolvedEnderman.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); return 1; } }
private void renderVignette(float f, int i, int j) { f = 1.0F - f; if (f < 0.0F) { f = 0.0F; } if (f > 1.0F) { f = 1.0F; } prevVignetteBrightness += (double) (f - prevVignetteBrightness) * 0.01D; GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); GL11.glBlendFunc(0, 769); GL11.glColor4f(prevVignetteBrightness, prevVignetteBrightness, prevVignetteBrightness, 1.0F); GL11.glBindTexture( 3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("%blur%/misc/vignette.png")); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, j, -90D, 0.0D, 1.0D); tessellator.addVertexWithUV(i, j, -90D, 1.0D, 1.0D); tessellator.addVertexWithUV(i, 0.0D, -90D, 1.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBlendFunc(770, 771); }
/** Updates the small achievement tooltip window, showing a queued achievement if is needed. */ public void updateAchievementWindow() { if (this.theAchievement != null && this.achievementTime != 0L) { double var1 = (double) (System.currentTimeMillis() - this.achievementTime) / 3000.0D; if (!this.haveAchiement && (var1 < 0.0D || var1 > 1.0D)) { this.achievementTime = 0L; } else { this.updateAchievementWindowScale(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); double var3 = var1 * 2.0D; if (var3 > 1.0D) { var3 = 2.0D - var3; } var3 *= 4.0D; var3 = 1.0D - var3; if (var3 < 0.0D) { var3 = 0.0D; } var3 *= var3; var3 *= var3; int var5 = this.achievementWindowWidth - 160; int var6 = 0 - (int) (var3 * 36.0D); int var7 = this.theGame.renderEngine.getTexture("/achievement/bg.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D, var7); GL11.glDisable(GL11.GL_LIGHTING); this.drawTexturedModalRect(var5, var6, 96, 202, 160, 32); if (this.haveAchiement) { this.theGame.fontRenderer.drawSplitString( this.achievementStatName, var5 + 30, var6 + 7, 120, -1); } else { this.theGame.fontRenderer.drawString( this.achievementGetLocalText, var5 + 30, var6 + 7, -256); this.theGame.fontRenderer.drawString(this.achievementStatName, var5 + 30, var6 + 18, -1); } RenderHelper.enableGUIStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_LIGHTING); this.itemRender.renderItemIntoGUI( this.theGame.fontRenderer, this.theGame.renderEngine, this.theAchievement.theItemStack, var5 + 8, var6 + 8); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); } } }
private void renderPortalOverlay(float var1, int var2, int var3) { if (var1 < 1.0F) { var1 *= var1; var1 *= var1; var1 = var1 * 0.8F + 0.2F; } GL11.glDisable(3008 /*GL_ALPHA_TEST*/); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); GL11.glBlendFunc(770, 771); GL11.glColor4f(1.0F, 1.0F, 1.0F, var1); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, this.mc.renderEngine.getTexture("/terrain.png")); float var4 = (float) (Block.portal.blockIndexInTexture % 16) / 16.0F; float var5 = (float) (Block.portal.blockIndexInTexture / 16) / 16.0F; float var6 = (float) (Block.portal.blockIndexInTexture % 16 + 1) / 16.0F; float var7 = (float) (Block.portal.blockIndexInTexture / 16 + 1) / 16.0F; Tessellator var8 = Tessellator.instance; var8.startDrawingQuads(); var8.addVertexWithUV(0.0D, (double) var3, -90.0D, (double) var4, (double) var7); var8.addVertexWithUV((double) var2, (double) var3, -90.0D, (double) var6, (double) var7); var8.addVertexWithUV((double) var2, 0.0D, -90.0D, (double) var6, (double) var5); var8.addVertexWithUV(0.0D, 0.0D, -90.0D, (double) var4, (double) var5); var8.draw(); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTick) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); int side = -1; if (tile != null && tile instanceof TileInjector) side = ((TileInjector) tile).side; switch (side) { case 2: GL11.glRotatef(270, 0F, 1F, 0F); break; case 3: GL11.glRotatef(90, 0F, 1F, 0F); break; case 4: break; case 5: GL11.glRotatef(180, 0F, 1F, 0F); break; case -1: break; default: break; } renderLiquids(tile); renderItems(tile); Minecraft.getMinecraft().renderEngine.bindTexture(this.textureFrame); this.modelFrame.renderAll(); GL11.glPushMatrix(); GL11.glTranslatef((float) +0.3F, (float) -0.15F, (float) 0); EntityItem itemEntity2 = new EntityItem(tile.getWorldObj(), 0, 0, 0, new ItemStack(ModItems.itemFluidModule)); itemEntity2.hoverStart = 0.0F; GL11.glScalef(0.9F, 0.9F, 0.9F); RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(itemEntity2, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glScalef(1.01F, 1.01F, 1.01F); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1F, 1F, 1F, 0.5F); Minecraft.getMinecraft().renderEngine.bindTexture(this.textureGlass); this.modelGlass.renderAll(); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); GL11.glPopMatrix(); }
public void func_73847_a() { if (this.field_73850_f != null && this.field_73851_g != 0L) { double var1 = (double) (Minecraft.func_71386_F() - this.field_73851_g) / 3000.0D; if (!this.field_73857_j && (var1 < 0.0D || var1 > 1.0D)) { this.field_73851_g = 0L; } else { this.func_73849_b(); GL11.glDisable(2929); GL11.glDepthMask(false); double var3 = var1 * 2.0D; if (var3 > 1.0D) { var3 = 2.0D - var3; } var3 *= 4.0D; var3 = 1.0D - var3; if (var3 < 0.0D) { var3 = 0.0D; } var3 *= var3; var3 *= var3; int var5 = this.field_73854_b - 160; int var6 = 0 - (int) (var3 * 36.0D); int var7 = this.field_73856_a.field_71446_o.func_78341_b("/achievement/bg.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(3553); GL11.glBindTexture(3553, var7); GL11.glDisable(2896); this.func_73729_b(var5, var6, 96, 202, 160, 32); if (this.field_73857_j) { this.field_73856_a.field_71466_p.func_78279_b( this.field_73853_e, var5 + 30, var6 + 7, 120, -1); } else { this.field_73856_a.field_71466_p.func_78276_b( this.field_73852_d, var5 + 30, var6 + 7, -256); this.field_73856_a.field_71466_p.func_78276_b( this.field_73853_e, var5 + 30, var6 + 18, -1); } RenderHelper.func_74520_c(); GL11.glDisable(2896); GL11.glEnable('\u803a'); GL11.glEnable(2903); GL11.glEnable(2896); this.field_73858_h.func_77015_a( this.field_73856_a.field_71466_p, this.field_73856_a.field_71446_o, this.field_73850_f.field_75990_d, var5 + 8, var6 + 8); GL11.glDisable(2896); GL11.glDepthMask(true); GL11.glEnable(2929); } } }
public void a(kw tileEntity, double x, double y, double z, float f) { boolean isThermo = tileEntity instanceof TileEntityIC2Thermo; if(isThermo) { GL11.glPushMatrix(); TileEntityIC2Thermo thermo = (TileEntityIC2Thermo)tileEntity; short side = thermo.getFacing(); float var12 = 0.01666667F; int heat = (thermo.getHeatLevel() / 500) * 500; String text = Integer.toString(heat); GL11.glTranslatef((float)x, (float)y, (float)z); switch(side) { case 1: // '\001' GL11.glTranslatef(1.0F, 1.0F, 0.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); break; case 2: // '\002' GL11.glTranslatef(0.0F, 1.0F, 0.0F); GL11.glRotatef(0.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); break; case 3: // '\003' GL11.glTranslatef(1.0F, 1.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); break; case 4: // '\004' GL11.glTranslatef(0.0F, 1.0F, 1.0F); GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); break; case 5: // '\005' GL11.glTranslatef(1.0F, 1.0F, 0.0F); GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); break; } GL11.glTranslatef(0.5F, 0.4377F, 0.6875F); nl fontRenderer = a(); GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F); GL11.glScalef(var12, -var12, var12); GL11.glDepthMask(false); fontRenderer.b(text, -fontRenderer.a(text) / 2, -fontRenderer.b, 0); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }
/** Renders the animation for when an enderdragon dies */ protected void renderDragonDying(EntityDragon par1EntityDragon, float par2) { super.renderEquippedItems(par1EntityDragon, par2); Tessellator tessellator = Tessellator.instance; if (par1EntityDragon.deathTicks > 0) { RenderHelper.disableStandardItemLighting(); float f = ((float) par1EntityDragon.deathTicks + par2) / 200F; float f1 = 0.0F; if (f > 0.8F) { f1 = (f - 0.8F) / 0.2F; } Random random = new Random(432L); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -1F, -2F); for (int i = 0; (float) i < ((f + f * f) / 2.0F) * 60F; i++) { GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F + f * 90F, 0.0F, 0.0F, 1.0F); tessellator.startDrawing(6); float f2 = random.nextFloat() * 20F + 5F + f1 * 10F; float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F; tessellator.setColorRGBA_I(0xffffff, (int) (255F * (1.0F - f1))); tessellator.addVertex(0.0D, 0.0D, 0.0D); tessellator.setColorRGBA_I(0xff00ff, 0); tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3); tessellator.addVertex(0.86599999999999999D * (double) f3, f2, -0.5F * f3); tessellator.addVertex(0.0D, f2, 1.0F * f3); tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3); tessellator.draw(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); RenderHelper.enableStandardItemLighting(); } }
/** Renders the animation for when an enderdragon dies */ protected void renderDragonDying(EntityDragonBoss par1entitydragonboss, float par2) { super.renderEquippedItems(par1entitydragonboss, par2); Tessellator tessellator = Tessellator.instance; if (par1entitydragonboss.deathTicks > 0) { RenderHelper.disableStandardItemLighting(); float f1 = (par1entitydragonboss.deathTicks + par2) / 200.0F; float f2 = 0.0F; if (f1 > 0.8F) { f2 = (f1 - 0.8F) / 0.2F; } Random random = new Random(432L); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -1.0F, -2.0F); for (int i = 0; i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i) { GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F); tessellator.startDrawing(6); float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F; float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F; tessellator.setColorRGBA_I(16777215, (int) (255.0F * (1.0F - f2))); tessellator.addVertex(0.0D, 0.0D, 0.0D); tessellator.setColorRGBA_I(16711935, 0); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0.0D, f3, 1.0F * f4); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.draw(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); RenderHelper.enableStandardItemLighting(); } }
/** GL_DrawParticles */ void GL_DrawParticles(int num_particles) { float origin_x, origin_y, origin_z; Math3D.VectorScale(vup, 1.5f, up); Math3D.VectorScale(vright, 1.5f, right); GL_Bind(r_particletexture.texnum); GL11.glDepthMask(false); // no z buffering GL11.glEnable(GL11.GL_BLEND); GL_TexEnv(GL11.GL_MODULATE); GL11.glBegin(GL11.GL_TRIANGLES); FloatBuffer sourceVertices = particle_t.vertexArray; IntBuffer sourceColors = particle_t.colorArray; float scale; int color; for (int j = 0, i = 0; i < num_particles; i++) { origin_x = sourceVertices.get(j++); origin_y = sourceVertices.get(j++); origin_z = sourceVertices.get(j++); // hack a scale up to keep particles from disapearing scale = (origin_x - r_origin[0]) * vpn[0] + (origin_y - r_origin[1]) * vpn[1] + (origin_z - r_origin[2]) * vpn[2]; scale = (scale < 20) ? 1 : 1 + scale * 0.004f; color = sourceColors.get(i); GL11.glColor4ub( (byte) ((color) & 0xFF), (byte) ((color >> 8) & 0xFF), (byte) ((color >> 16) & 0xFF), (byte) ((color >>> 24))); // first vertex GL11.glTexCoord2f(0.0625f, 0.0625f); GL11.glVertex3f(origin_x, origin_y, origin_z); // second vertex GL11.glTexCoord2f(1.0625f, 0.0625f); GL11.glVertex3f(origin_x + up[0] * scale, origin_y + up[1] * scale, origin_z + up[2] * scale); // third vertex GL11.glTexCoord2f(0.0625f, 1.0625f); GL11.glVertex3f( origin_x + right[0] * scale, origin_y + right[1] * scale, origin_z + right[2] * scale); } GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1, 1, 1, 1); GL11.glDepthMask(true); // back to normal Z buffering GL_TexEnv(GL11.GL_REPLACE); }
protected void renderLivingLabel( EntityLiving var1, String var2, double var3, double var5, double var7, int var9, int color, int color2) { // Spout end float var10 = var1.getDistanceToEntity(this.renderManager.livingPlayer); if (var10 <= (float) var9) { FontRenderer var11 = this.getFontRendererFromRenderManager(); float var12 = 1.6F; float var13 = 0.016666668F * var12; GL11.glPushMatrix(); GL11.glTranslatef((float) var3 + 0.0F, (float) var5 + 2.3F, (float) var7); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-var13, -var13, var13); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDepthMask(false); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glEnable(3042 /*GL_BLEND*/); GL11.glBlendFunc(770, 771); Tessellator var14 = Tessellator.instance; byte var15 = 0; if (var2.equals("deadmau5")) { var15 = -10; } GL11.glDisable(3553 /*GL_TEXTURE_2D*/); var14.startDrawingQuads(); int var16 = var11.getStringWidth(var2) / 2; var14.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); var14.addVertex((double) (-var16 - 1), (double) (-1 + var15), 0.0D); var14.addVertex((double) (-var16 - 1), (double) (8 + var15), 0.0D); var14.addVertex((double) (var16 + 1), (double) (8 + var15), 0.0D); var14.addVertex((double) (var16 + 1), (double) (-1 + var15), 0.0D); var14.draw(); GL11.glEnable(3553 /*GL_TEXTURE_2D*/); var11.drawString( var2, -var11.getStringWidth(var2) / 2, var15, color); // Spout (changed to color var) GL11.glEnable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(true); var11.drawString( var2, -var11.getStringWidth(var2) / 2, var15, color2); // Spout (changed to color2 var) GL11.glEnable(2896 /*GL_LIGHTING*/); GL11.glDisable(3042 /*GL_BLEND*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }
public static void drawTTFString(CustomFont f, String text, double x, double y, int color) { GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_POINT_SMOOTH); GL11.glHint(GL11.GL_POINT_SMOOTH_HINT, GL11.GL_NICEST); GL11.glDepthMask(false); f.drawGoodString(mc.ingameGUI, text, x, y, color, false); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_POINT_SMOOTH); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); }
/** Used to render a player's name above their head */ protected void renderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6) { if (Minecraft.isGuiEnabled() && par1EntityPlayer != renderManager.livingPlayer) { float f = 1.6F; float f1 = 0.01666667F * f; float f2 = par1EntityPlayer.getDistanceToEntity(renderManager.livingPlayer); float f3 = par1EntityPlayer.isSneaking() ? 32F : 64F; if (f2 < f3) { String s = par1EntityPlayer.username; if (!par1EntityPlayer.isSneaking()) { if (par1EntityPlayer.isPlayerSleeping()) { renderLivingLabel(par1EntityPlayer, s, par2, par4 - 1.5D, par6, 64); } else { renderLivingLabel(par1EntityPlayer, s, par2, par4, par6, 64); } } else { FontRenderer fontrenderer = getFontRendererFromRenderManager(); GL11.glPushMatrix(); GL11.glTranslatef((float) par2 + 0.0F, (float) par4 + 2.3F, (float) par6); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0F, 0.25F / f1, 0.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tessellator = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(s) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1D, 0.0D); tessellator.addVertex(-i - 1, 8D, 0.0D); tessellator.addVertex(i + 1, 8D, 0.0D); tessellator.addVertex(i + 1, -1D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 0x20ffffff); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } } }
/** Draws the debug or playername text above a living */ protected void renderLivingLabel( EntityLiving par1EntityLiving, String par2Str, double par3, double par5, double par7, int par9) { float f = par1EntityLiving.getDistanceToEntity(renderManager.livingPlayer); if (f > (float) par9) { return; } FontRenderer fontrenderer = getFontRendererFromRenderManager(); float f1 = 1.6F; float f2 = 0.01666667F * f1; GL11.glPushMatrix(); GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + 2.3F, (float) par7); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f2, -f2, f2); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); Tessellator tessellator = Tessellator.instance; byte byte0 = 0; if (par2Str.equals("deadmau5")) { byte0 = -10; } GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int i = fontrenderer.getStringWidth(par2Str) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-i - 1, -1 + byte0, 0.0D); tessellator.addVertex(-i - 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, 8 + byte0, 0.0D); tessellator.addVertex(i + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, byte0, 0x20ffffff); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, byte0, -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
public void updateAchievementWindow() { if (theAchievement == null || achievementTime == 0L) { return; } double d = (double) (System.currentTimeMillis() - achievementTime) / 3000D; if (!haveAchiement && !haveAchiement && (d < 0.0D || d > 1.0D)) { achievementTime = 0L; return; } updateAchievementWindowScale(); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); double d1 = d * 2D; if (d1 > 1.0D) { d1 = 2D - d1; } d1 *= 4D; d1 = 1.0D - d1; if (d1 < 0.0D) { d1 = 0.0D; } d1 *= d1; d1 *= d1; int i = achievementWindowWidth - 160; int j = 0 - (int) (d1 * 36D); int k = theGame.renderEngine.getTexture("/achievement/bg.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(3553 /*GL_TEXTURE_2D*/); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, k); GL11.glDisable(2896 /*GL_LIGHTING*/); drawTexturedModalRect(i, j, 96, 202, 160, 32); if (haveAchiement) { theGame.fontRenderer.drawSplitString(achievementStatName, i + 30, j + 7, 120, -1); } else { theGame.fontRenderer.drawString(achievementGetLocalText, i + 30, j + 7, -256); theGame.fontRenderer.drawString(achievementStatName, i + 30, j + 18, -1); } GL11.glPushMatrix(); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/); GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/); GL11.glEnable(2896 /*GL_LIGHTING*/); itemRender.renderItemIntoGUI( theGame.fontRenderer, theGame.renderEngine, theAchievement.theItemStack, i + 8, j + 8); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); }
protected void func_22015_a( EntityPlayer p_22015_1_, double p_22015_2_, double p_22015_4_, double p_22015_6_) { if (Minecraft.func_22006_t() && p_22015_1_ != this.field_191_a.field_22188_h) { float var8 = 1.6F; float var9 = 0.016666668F * var8; float var10 = p_22015_1_.func_379_d(this.field_191_a.field_22188_h); float var11 = p_22015_1_.func_381_o() ? 32.0F : 64.0F; if (var10 < var11) { String var12 = p_22015_1_.field_771_i; if (!p_22015_1_.func_381_o()) { if (p_22015_1_.func_22051_K()) { this.func_22013_a(p_22015_1_, var12, p_22015_2_, p_22015_4_ - 1.5D, p_22015_6_, 64); } else { this.func_22013_a(p_22015_1_, var12, p_22015_2_, p_22015_4_, p_22015_6_, 64); } } else { FontRenderer var13 = this.func_6329_a(); GL11.glPushMatrix(); GL11.glTranslatef( (float) p_22015_2_ + 0.0F, (float) p_22015_4_ + 2.3F, (float) p_22015_6_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.field_191_a.field_1225_i, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.field_191_a.field_1224_j, 1.0F, 0.0F, 0.0F); GL11.glScalef(-var9, -var9, var9); GL11.glDisable(2896); GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F); GL11.glDepthMask(false); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); Tessellator var14 = Tessellator.field_1512_a; GL11.glDisable(3553); var14.func_977_b(); int var15 = var13.func_871_a(var12) / 2; var14.func_986_a(0.0F, 0.0F, 0.0F, 0.25F); var14.func_991_a((double) (-var15 - 1), -1.0D, 0.0D); var14.func_991_a((double) (-var15 - 1), 8.0D, 0.0D); var14.func_991_a((double) (var15 + 1), 8.0D, 0.0D); var14.func_991_a((double) (var15 + 1), -1.0D, 0.0D); var14.func_982_a(); GL11.glEnable(3553); GL11.glDepthMask(true); var13.func_873_b(var12, -var13.func_871_a(var12) / 2, 0, 553648127); GL11.glEnable(2896); GL11.glDisable(3042); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } } } }
@SideOnly(Side.CLIENT) private static void renderEnderSky() { TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager(); GL11.glDisable(GL11.GL_FOG); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); RenderHelper.disableStandardItemLighting(); GL11.glDepthMask(false); renderEngine.bindTexture(locationEndSkyPng); Tessellator tessellator = Tessellator.instance; for (int i = 0; i < 6; ++i) { GL11.glPushMatrix(); if (i == 1) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (i == 2) { GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } if (i == 3) { GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); } if (i == 4) { GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } if (i == 5) { GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(2631720); tessellator.addVertexWithUV(-100.0D, -100.0D, -100.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(-100.0D, -100.0D, 100.0D, 0.0D, 16.0D); tessellator.addVertexWithUV(100.0D, -100.0D, 100.0D, 16.0D, 16.0D); tessellator.addVertexWithUV(100.0D, -100.0D, -100.0D, 16.0D, 0.0D); tessellator.draw(); GL11.glPopMatrix(); } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); }
public void renderParticles(Entity entity, float f) { float f1 = ActiveRenderInfo.rotationX; float f2 = ActiveRenderInfo.rotationZ; float f3 = ActiveRenderInfo.rotationYZ; float f4 = ActiveRenderInfo.rotationXY; float f5 = ActiveRenderInfo.rotationXZ; EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) f; EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) f; EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) f; for (int k = 0; k < fxes.length; ++k) { if (!this.fxes[k].isEmpty()) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); switch (k) { case 0: GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); renderer.bindTexture(additiveTextureSheet); break; } GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); for (int j = 0; j < this.fxes[k].size(); ++j) { final EntityFX entityfx = this.fxes[k].get(j); if (entityfx == null) continue; tessellator.setBrightness(entityfx.getBrightnessForRender(f)); try { entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Particle being rendered"); crashreportcategory.addCrashSectionCallable("Particle", entityfx::toString); throw new ReportedException(crashreport); } } tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); } } }
private void renderEffectSlot(TextureManager manager, int x, int y) { GL11.glDepthFunc(GL11.GL_EQUAL); // GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); manager.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); // this.renderGlintSlot(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20); this.renderGlintSlot(x, y, 150, 20); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(true); // GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
@Override protected void init() { initializeProgram(); try { cylinderMesh = new Mesh("UnitCylinder.xml"); planeMesh = new Mesh("LargePlane.xml"); } catch (Exception exception) { exception.printStackTrace(); System.exit(-1); } glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glFrontFace(GL_CW); glEnable(GL_DEPTH_TEST); glDepthMask(true); glDepthFunc(GL_LEQUAL); glDepthRange(0.0f, 1.0f); glEnable(GL_DEPTH_CLAMP); projectionUniformBuffer = glGenBuffers(); glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer); glBufferData(GL_UNIFORM_BUFFER, ProjectionBlock.SIZE, GL_DYNAMIC_DRAW); // Bind the static buffers. glBindBufferRange( GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, ProjectionBlock.SIZE); glBindBuffer(GL_UNIFORM_BUFFER, 0); }
public void clearBuffers(boolean color, boolean depth, boolean stencil) { int bits = 0; if (color) { // See explanations of the depth below, we must enable color write to be able to clear the // color buffer if (context.colorWriteEnabled == false) { glColorMask(true, true, true, true); context.colorWriteEnabled = true; } bits = GL_COLOR_BUFFER_BIT; } if (depth) { // glClear(GL_DEPTH_BUFFER_BIT) seems to not work when glDepthMask is false // here s some link on openl board // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=257223 // if depth clear is requested, we enable the depthMask if (context.depthWriteEnabled == false) { glDepthMask(true); context.depthWriteEnabled = true; } bits |= GL_DEPTH_BUFFER_BIT; } if (stencil) { bits |= GL_STENCIL_BUFFER_BIT; } if (bits != 0) { glClear(bits); } }
public static void dispatch() { Profiler profiler = ClientUtils.mc().mcProfiler; profiler.startSection(ImmersiveEngineering.MODID + "-particles"); boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); for (String key : EntityFXIEBase.queuedRenders.keySet()) { profiler.endStartSection(key); int i = 0; ClientUtils.tes().startDrawingQuads(); for (EntityFXIEBase particle : EntityFXIEBase.queuedRenders.get(key)) { if ((i++) == 0) ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture()); particle.tessellateFromQueue(ClientUtils.tes()); } ClientUtils.tes().draw(); } EntityFXIEBase.queuedRenders.clear(); profiler.startSection("depthIgnoring"); GL11.glDisable(GL11.GL_DEPTH_TEST); for (String key : EntityFXIEBase.queuedDepthIgnoringRenders.keySet()) { profiler.endStartSection(key); int i = 0; ClientUtils.tes().startDrawingQuads(); for (EntityFXIEBase particle : EntityFXIEBase.queuedDepthIgnoringRenders.get(key)) { if ((i++) == 0) ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture()); particle.tessellateFromQueue(ClientUtils.tes()); } ClientUtils.tes().draw(); } EntityFXIEBase.queuedDepthIgnoringRenders.clear(); GL11.glEnable(GL11.GL_DEPTH_TEST); profiler.endSection(); if (!isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); profiler.endSection(); }