public static void drawPlayerOnGui( Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef((float) par1, (float) par2, 50.0F); GL11.glScalef((float) (-par3), (float) par3, (float) par3); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); float f2 = par0Minecraft.thePlayer.renderYawOffset; float f3 = par0Minecraft.thePlayer.rotationYaw; float f4 = par0Minecraft.thePlayer.rotationPitch; par4 -= 19; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F; par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F; par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F; par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw; GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw( par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); par0Minecraft.thePlayer.renderYawOffset = f2; par0Minecraft.thePlayer.rotationYaw = f3; par0Minecraft.thePlayer.rotationPitch = f4; GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); }
public static void renderSphere(Vector3f center, float radius, Vector3f colour) { glPushAttrib(GL_ENABLE_BIT); { glDisable(GL_TEXTURE_2D); // Texture 2D is disabled so no textures are incorporated glDisable(GL_LIGHTING); // Lighting is turned off for 2D glBegin(GL_LINE_LOOP); { glColor3f(colour.x, colour.y, colour.z); for (int i = 0; i < 360; i++) { double degInRad = i * Math.PI / 180; glVertex3f( (float) (center.x + Math.cos(degInRad) * radius), (float) (center.y + Math.sin(degInRad) * radius), center.z); } } glEnd(); glBegin(GL_LINE_LOOP); { glColor3f(colour.x, colour.y, colour.z); for (int i = 0; i < 360; i++) { double degInRad = i * Math.PI / 180; glVertex3f( center.x, (float) (center.y + Math.cos(degInRad) * radius), (float) (center.z + Math.sin(degInRad) * radius)); } } glEnd(); } glPopAttrib(); }
public static void drawFace( double x, double y, double z, double x2, double y2, double z2, float red, float green, float blue, float lineWidth) { Tessellator var12 = Tessellator.instance; GL11.glPushMatrix(); GL11.glLineWidth(lineWidth); GL11.glDisable(3553); var12.startDrawing(3); var12.setColorRGBA_F(red, green, blue, 1); var12.addVertex(x, y, z); var12.addVertex(x2, y, z2); var12.addVertex(x2, y2, z2); var12.addVertex(x, y2, z2); // var12.addVertex(x2, y2, z2); var12.draw(); GL11.glBlendFunc(770, 771); GL11.glDisable(32826); GL11.glEnable(3553); GL11.glPopMatrix(); }
private void drawLightningBolt(Entity entity) { glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glColor3f(0, 0.6f, 1); glBegin(GL_QUADS); int lastX = 0; int lastY = 0; for (int i = 0; i < 60; i++) { int x = i * 2; int y = (int) (Math.sin(i * (Math.PI / 4) - entity.ticksExisted * 2.05f) * 2.5f); glColor3f(1, 1f, 1); glVertex3d(x + 0, y + 0, 0); glVertex3d(x + 0, y + 1, 0); glVertex3d(lastX, lastY + 1, 0); glVertex3d(lastX, lastY, 0); glColor3f(0, 0.6f, 1); glVertex3d(x + 0, y + 1, 0); glVertex3d(x + 0, y + 1.25, 0); glVertex3d(lastX, lastY + 1.25, 0); glVertex3d(lastX, lastY + 1, 0); glVertex3d(x + 0, y - 0.25, 0); glVertex3d(x + 0, y, 0); glVertex3d(lastX, lastY, 0); glVertex3d(lastX, lastY - 0.25, 0); lastX = x; lastY = y; } glEnd(); glEnable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); }
public void drawPlayerOnGui( Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) { final float pitchBefore = par0Minecraft.thePlayer.rotationPitch; GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix(); GL11.glTranslatef(par1, par2, 50.0F); GL11.glScalef(-par3, par3, par3); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); final float var6 = par0Minecraft.thePlayer.renderYawOffset; final float var7 = par0Minecraft.thePlayer.rotationYaw; final float var8 = par0Minecraft.thePlayer.rotationPitch; GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-((float) Math.atan(this.rotation / 40.0F)) * 00.0F, 1.0F, 0.0F, 0.0F); par0Minecraft.thePlayer.renderYawOffset = this.rotation; par0Minecraft.thePlayer.rotationYaw = this.rotation; par0Minecraft.thePlayer.rotationPitch = 0; par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw; GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F); RenderManager.instance.playerViewY = 180.0F; RenderManager.instance.renderEntityWithPosYaw( par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); par0Minecraft.thePlayer.renderYawOffset = var6; par0Minecraft.thePlayer.rotationYaw = var7; // par0Minecraft.thePlayer.rotationPitch = var8; GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); par0Minecraft.thePlayer.rotationPitch = pitchBefore; }
@Override protected void renderModel( EntityDragonMinion par1EntityDragonMinion, float par2, float par3, float par4, float par5, float par6, float par7) { bindEntityTexture(par1EntityDragonMinion); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7); GL11.glDisable(GL11.GL_BLEND); if (par1EntityDragonMinion.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragonMinion, par2, par3, par4, par5, par6, par7); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
/** 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); } }
/** Applies fixed function bindings from the context to OpenGL */ private void applyFixedFuncBindings(boolean forLighting) { if (forLighting) { glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, context.shininess); setMaterialColor(GL_AMBIENT, context.ambient, ColorRGBA.DarkGray); setMaterialColor(GL_DIFFUSE, context.diffuse, ColorRGBA.White); setMaterialColor(GL_SPECULAR, context.specular, ColorRGBA.Black); if (context.useVertexColor) { glEnable(GL_COLOR_MATERIAL); } else { glDisable(GL_COLOR_MATERIAL); } } else { // Ignore other values as they have no effect when // GL_LIGHTING is disabled. ColorRGBA color = context.color; if (color != null) { glColor4f(color.r, color.g, color.b, color.a); } else { glColor4f(1, 1, 1, 1); } } if (context.alphaTestFallOff > 0f) { glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, context.alphaTestFallOff); } else { glDisable(GL_ALPHA_TEST); } }
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; } }
/** Renders the dragon model. Called by renderModel. */ protected void renderDragonModel( EntityDragon par1EntityDragon, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityDragon.deathTicks > 0) { float f = (float) par1EntityDragon.deathTicks / 200F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, f); loadDownloadableImageTexture(par1EntityDragon.skinUrl, "/mob/enderdragon/shuffle.png"); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthFunc(GL11.GL_EQUAL); } loadDownloadableImageTexture(par1EntityDragon.skinUrl, par1EntityDragon.getTexture()); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); if (par1EntityDragon.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
/** Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass. */ protected int renderGlow(EntityDragon par1EntityDragon, int par2, float par3) { if (par2 == 1) { GL11.glDepthFunc(GL11.GL_LEQUAL); } if (par2 != 0) { return -1; } else { loadTexture("/mob/enderdragon/ender_eyes.png"); float f = 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); GL11.glDepthFunc(GL11.GL_EQUAL); int i = 61680; int j = i % 0x10000; int k = i / 0x10000; OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) 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, f); return 1; } }
protected int func_27006_a(GCMarsEntityCreeperBoss par1EntityCreeper, int par2, float par3) { if (par1EntityCreeper.headsRemaining == 1) { if (par2 == 1) { final float var4 = par1EntityCreeper.ticksExisted + par3; this.bindTexture(GCMarsRenderCreeperBoss.powerTexture); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); final float var5 = var4 * 0.01F; final float var6 = var4 * 0.01F; GL11.glTranslatef(var5, var6, 0.0F); this.setRenderPassModel(this.creeperModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); final float var7 = 0.5F; GL11.glColor4f(var7, var7, var7, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (par2 == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }
public static void drawRegion(TextureRegion tex, int x, int y, int w, int h) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, tex.id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBegin(GL_QUADS); { glTexCoord2f(tex.u, tex.v); glVertex2f(x, y); glTexCoord2f(tex.u2, tex.v); glVertex2f(x + w, y); glTexCoord2f(tex.u2, tex.v2); glVertex2f(x + w, y + h); glTexCoord2f(tex.u, tex.v2); glVertex2f(x, y + h); } glEnd(); glBindTexture(GL_TEXTURE_2D, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); }
public static void drawModel(Model m) { glFrontFace(GL_CCW); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); for (Polygon p : m.mesh) { glBindTexture(GL_TEXTURE_2D, p.tex.id); glBegin(GL_TRIANGLES); { for (Vertex v : p.vertices) { glTexCoord2f(v.uv.x, v.uv.y); glNormal3f(v.norm.x, v.norm.y, v.norm.z); glVertex3f(v.pos.x, v.pos.y, v.pos.z); } } glEnd(); } glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); }
@Override public void draw(int startX, int startY) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableGUIStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); ItemStack output = getOutputStack(); if (output != null) manager.gui.drawItemStack(output, startX + xPos, startY + yPos); // RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_DEPTH_TEST); if (worktable.getMemory().isLocked(slotNumber)) { manager.gui.setZLevel(110f); Proxies.common.bindTexture(SpriteSheet.ITEMS); manager.gui.drawTexturedModelRectFromIcon( startX + xPos, startY + yPos, TextureManager.getInstance().getDefault("slots/locked"), 16, 16); manager.gui.setZLevel(0f); } GL11.glPopAttrib(); }
protected void func_74190_a(String p_74190_1_, int p_74190_2_, int p_74190_3_) { GL11.glDisable('\u803a'); RenderHelper.func_74518_a(); GL11.glDisable(2896); GL11.glDisable(2929); int var4 = this.field_73886_k.func_78256_a(p_74190_1_); int var5 = p_74190_2_ + 12; int var6 = p_74190_3_ - 12; byte var8 = 8; this.field_73735_i = 300.0F; field_74196_a.field_77023_b = 300.0F; int var9 = -267386864; this.func_73733_a(var5 - 3, var6 - 4, var5 + var4 + 3, var6 - 3, var9, var9); this.func_73733_a(var5 - 3, var6 + var8 + 3, var5 + var4 + 3, var6 + var8 + 4, var9, var9); this.func_73733_a(var5 - 3, var6 - 3, var5 + var4 + 3, var6 + var8 + 3, var9, var9); this.func_73733_a(var5 - 4, var6 - 3, var5 - 3, var6 + var8 + 3, var9, var9); this.func_73733_a(var5 + var4 + 3, var6 - 3, var5 + var4 + 4, var6 + var8 + 3, var9, var9); int var10 = 1347420415; int var11 = (var10 & 16711422) >> 1 | var10 & -16777216; this.func_73733_a(var5 - 3, var6 - 3 + 1, var5 - 3 + 1, var6 + var8 + 3 - 1, var10, var11); this.func_73733_a( var5 + var4 + 2, var6 - 3 + 1, var5 + var4 + 3, var6 + var8 + 3 - 1, var10, var11); this.func_73733_a(var5 - 3, var6 - 3, var5 + var4 + 3, var6 - 3 + 1, var10, var10); this.func_73733_a(var5 - 3, var6 + var8 + 2, var5 + var4 + 3, var6 + var8 + 3, var11, var11); this.field_73886_k.func_78261_a(p_74190_1_, var5, var6, -1); this.field_73735_i = 0.0F; field_74196_a.field_77023_b = 0.0F; GL11.glEnable(2896); GL11.glEnable(2929); RenderHelper.func_74519_b(); GL11.glEnable('\u803a'); }
public void func_579_b(int p_579_1_) { GL11.glDisable(2896); GL11.glDisable(2912); Tessellator var2 = Tessellator.field_1512_a; GL11.glBindTexture(3553, this.field_945_b.field_6315_n.func_1070_a("/gui/background.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float var3 = 32.0F; var2.func_977_b(); var2.func_990_b(4210752); var2.func_983_a( 0.0D, (double) this.field_950_d, 0.0D, 0.0D, (double) ((float) this.field_950_d / var3 + (float) p_579_1_)); var2.func_983_a( (double) this.field_951_c, (double) this.field_950_d, 0.0D, (double) ((float) this.field_951_c / var3), (double) ((float) this.field_950_d / var3 + (float) p_579_1_)); var2.func_983_a( (double) this.field_951_c, 0.0D, 0.0D, (double) ((float) this.field_951_c / var3), (double) p_579_1_); var2.func_983_a(0.0D, 0.0D, 0.0D, 0.0D, (double) p_579_1_); var2.func_982_a(); }
@Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { ReikaTextureHelper.bindFontTexture(); int j = (width - xSize) / 2; int k = (height - ySize) / 2; ReikaGuiAPI.instance.drawCenteredStringNoShadow( fontRendererObj, StatCollector.translateToLocal("chroma.routerfilter"), xSize / 2, 5, 0xffffff); for (int i = 0; i < 9; i++) { ItemRule ir = tile.getFilter(i); if (ir != null) { int x = 8 + i * 18; int y = 33; ReikaGuiAPI.instance.drawItemStack( itemRender, fontRendererObj, ReikaItemHelper.getSizedItemStack(ir.getItem(), 1), x, y); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); ReikaGuiAPI.instance.drawRectFrame(x - 1, y - 1, 18, 18, 0xff000000 | ir.mode.color); GL11.glPopAttrib(); } } }
/** 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); }
@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); }
/** R_PolyBlend */ void R_PolyBlend() { if (gl_polyblend.value == 0.0f) return; if (v_blend[3] == 0.0f) return; GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glLoadIdentity(); // FIXME: get rid of these GL11.glRotatef(-90, 1, 0, 0); // put Z going up GL11.glRotatef(90, 0, 0, 1); // put Z going up GL11.glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex3f(10, 100, 100); GL11.glVertex3f(10, -100, 100); GL11.glVertex3f(10, -100, -100); GL11.glVertex3f(10, 100, -100); GL11.glEnd(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1, 1, 1, 1); }
/** Initialise the GL context */ protected void initGL() { Log.info("Starting display " + width + "x" + height); String extensions = GL11.glGetString(GL11.GL_EXTENSIONS); 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.0f, 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); if (input == null) { input = new Input(height); } input.init(height); input.removeListener(lastGame); input.addListener(game); lastGame = game; }
public static void drawGradientRect( int minx, int miny, int maxx, int maxy, int zlevel, int color1, int color2) { float alpha1 = (float) (color1 >> 24 & 255) / 255.0F; float red1 = (float) (color1 >> 16 & 255) / 255.0F; float green1 = (float) (color1 >> 8 & 255) / 255.0F; float blue1 = (float) (color1 & 255) / 255.0F; float alpha2 = (float) (color2 >> 24 & 255) / 255.0F; float red2 = (float) (color2 >> 16 & 255) / 255.0F; float green2 = (float) (color2 >> 8 & 255) / 255.0F; float blue2 = (float) (color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); 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 tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(red1, green1, blue1, alpha1); tessellator.addVertex((double) maxx, (double) miny, (double) zlevel); tessellator.addVertex((double) minx, (double) miny, (double) zlevel); tessellator.setColorRGBA_F(red2, green2, blue2, alpha2); tessellator.addVertex((double) minx, (double) maxy, (double) zlevel); tessellator.addVertex((double) maxx, (double) maxy, (double) zlevel); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
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); }
/** 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; } }
public static void drawGradientRect( int x, int y, float z, int toX, int toY, Color color, Color colorFade) { GL11.glDisable(GL11.GL_TEXTURE_2D); 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 tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); vb.pos(toX, y, z) .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()) .endVertex(); vb.pos(x, y, z) .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()) .endVertex(); vb.pos(x, toY, z) .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha()) .endVertex(); vb.pos(toX, toY, z) .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha()) .endVertex(); tes.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
/** Renders the dragon model. Called by renderModel. */ protected void renderDragonModel( EntityDragonBoss par1EntityDragonBoss, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityDragonBoss.deathTicks > 0) { float f6 = par1EntityDragonBoss.deathTicks / 200.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, f6); bindTexture(field_110842_f); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthFunc(GL11.GL_EQUAL); } bindEntityTexture(par1EntityDragonBoss); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); if (par1EntityDragonBoss.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
/** draws the vertical line cursor in the textbox */ private void drawCursorVertical(int par1, int par2, int par3, int par4) { int var5; if (par1 < par3) { var5 = par1; par1 = par3; par3 = var5; } if (par2 < par4) { var5 = par2; par2 = par4; par4 = var5; } Tessellator var6 = Tessellator.instance; GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_COLOR_LOGIC_OP); GL11.glLogicOp(GL11.GL_OR_REVERSE); var6.startDrawingQuads(); var6.addVertex((double) par1, (double) par4, 0.0D); var6.addVertex((double) par3, (double) par4, 0.0D); var6.addVertex((double) par3, (double) par2, 0.0D); var6.addVertex((double) par1, (double) par2, 0.0D); var6.draw(); GL11.glDisable(GL11.GL_COLOR_LOGIC_OP); GL11.glEnable(GL11.GL_TEXTURE_2D); }
public static void drawLine( double x, double y, double x2, double y2, float red, float green, float blue, float lineWidth, float fadeSpeed) { int count = FMLClientHandler.instance().getClient().thePlayer.ticksExisted; float alpha = fadeSpeed + MathHelper.sin((float) (count + x)) * 0.3F + 0.3F; Tessellator var12 = Tessellator.instance; GL11.glPushMatrix(); GL11.glLineWidth(lineWidth); GL11.glDisable(3553); GL11.glEnable(3042); var12.startDrawing(3); var12.setColorRGBA_F(red, green, blue, alpha); var12.addVertex(x, y, 0.0D); var12.addVertex(x2, y2, 0.0D); var12.draw(); GL11.glBlendFunc(770, 771); GL11.glDisable(32826); GL11.glDisable(3042); GL11.glEnable(3553); GL11.glPopMatrix(); }
private static void drawGradientRect( int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_, float zLevel) { float f = (float) (p_73733_5_ >> 24 & 255) / 255.0F; float f1 = (float) (p_73733_5_ >> 16 & 255) / 255.0F; float f2 = (float) (p_73733_5_ >> 8 & 255) / 255.0F; float f3 = (float) (p_73733_5_ & 255) / 255.0F; float f4 = (float) (p_73733_6_ >> 24 & 255) / 255.0F; float f5 = (float) (p_73733_6_ >> 16 & 255) / 255.0F; float f6 = (float) (p_73733_6_ >> 8 & 255) / 255.0F; float f7 = (float) (p_73733_6_ & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(f1, f2, f3, f); tessellator.addVertex((double) p_73733_3_, (double) p_73733_2_, (double) zLevel); tessellator.addVertex((double) p_73733_1_, (double) p_73733_2_, (double) zLevel); tessellator.setColorRGBA_F(f5, f6, f7, f4); tessellator.addVertex((double) p_73733_1_, (double) p_73733_4_, (double) zLevel); tessellator.addVertex((double) p_73733_3_, (double) p_73733_4_, (double) zLevel); tessellator.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }