List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 disableDepthMask() { GL11.glDepthMask(false); return this; }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 enableDepthMask() { GL11.glDepthMask(true); return this; }
From source file:org.blockartistry.mod.DynSurround.client.fx.particle.EntityTextPopOffFX.java
License:MIT License
@Override public void renderParticle(final WorldRenderer renderer, final Entity entity, final float x, final float y, final float z, final float dX, final float dY, final float dZ) { this.rotationYaw = (-Minecraft.getMinecraft().thePlayer.rotationYaw); this.rotationPitch = Minecraft.getMinecraft().thePlayer.rotationPitch; final float locX = ((float) (this.prevPosX + (this.posX - this.prevPosX) * x - interpPosX)); final float locY = ((float) (this.prevPosY + (this.posY - this.prevPosY) * y - interpPosY)); final float locZ = ((float) (this.prevPosZ + (this.posZ - this.prevPosZ) * z - interpPosZ)); GL11.glPushMatrix();//from w w w . j a v a2 s . c om if (this.shouldOnTop) { GL11.glDepthFunc(519); } else { GL11.glDepthFunc(515); } GL11.glTranslatef(locX, locY, locZ); GL11.glRotatef(this.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.rotationPitch, 1.0F, 0.0F, 0.0F); GL11.glScalef(-1.0F, -1.0F, 1.0F); GL11.glScaled(this.particleScale * 0.008D, this.particleScale * 0.008D, this.particleScale * 0.008D); GL11.glScaled(this.scale, this.scale, this.scale); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 0.003662109F); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDisable(2896); GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glEnable(3008); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; fontRenderer.drawStringWithShadow(this.text, -MathHelper.floor_float(fontRenderer.getStringWidth(this.text) / 2.0F) + 1, -MathHelper.floor_float(fontRenderer.FONT_HEIGHT / 2.0F) + 1, this.renderColor.rgb()); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthFunc(515); GL11.glPopMatrix(); if (this.grow) { this.particleScale *= 1.08F; if (this.particleScale > SIZE * 3.0D) { this.grow = false; } } else { this.particleScale *= 0.96F; } }
From source file:org.blockartistry.mod.DynSurround.client.fx.particle.ParticleTextPopOff.java
License:MIT License
@Override public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { this.rotationYaw = (-Minecraft.getMinecraft().thePlayer.rotationYaw); this.rotationPitch = Minecraft.getMinecraft().thePlayer.rotationPitch; final float locX = ((float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks - interpPosX)); final float locY = ((float) (this.prevPosY + (this.posY - this.prevPosY) * partialTicks - interpPosY)); final float locZ = ((float) (this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks - interpPosZ)); GL11.glPushMatrix();/*from ww w. j a v a 2 s .c o m*/ if (this.showOnTop) { GL11.glDepthFunc(519); } else { GL11.glDepthFunc(515); } GL11.glTranslatef(locX, locY, locZ); GL11.glRotatef(this.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.rotationPitch, 1.0F, 0.0F, 0.0F); GL11.glScalef(-1.0F, -1.0F, 1.0F); GL11.glScaled(this.particleScale * 0.008D, this.particleScale * 0.008D, this.particleScale * 0.008D); GL11.glScaled(this.scale, this.scale, this.scale); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 0.003662109F); GL11.glEnable(3553); GL11.glDisable(3042); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(3553); GL11.glEnable(2929); GL11.glDisable(2896); GL11.glBlendFunc(770, 771); GL11.glEnable(3042); GL11.glEnable(3008); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; fontRenderer.drawStringWithShadow(this.text, -MathHelper.floor_float(fontRenderer.getStringWidth(this.text) / 2.0F) + 1, -MathHelper.floor_float(fontRenderer.FONT_HEIGHT / 2.0F) + 1, this.renderColor.rgb()); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDepthFunc(515); GL11.glPopMatrix(); if (this.grow) { this.particleScale *= 1.08F; if (this.particleScale > SIZE * 3.0D) { this.grow = false; } } else { this.particleScale *= 0.96F; } }
From source file:org.blockartistry.mod.ThermalRecycling.machines.entity.renderers.VendingTileEntityRenderer.java
License:MIT License
protected void renderName(final String name) { if (name.isEmpty()) return;// w ww . j a va 2 s . com final FontRenderer font = Minecraft.getMinecraft().fontRenderer; final Tessellator tessellator = Tessellator.instance; final int nameWidth = font.getStringWidth(name) / 2; GL11.glPushMatrix(); // Flip GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0F, 0.48F, -0.51F); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); GL11.glDisable(2896); GL11.glDepthMask(false); GL11.glDisable(2929); GL11.glEnable(3042); OpenGlHelper.glBlendFunc(770, 771, 1, 0); final byte byte0 = 0; GL11.glDisable(3553); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex(-nameWidth - 1, -1 + byte0, 0.0D); tessellator.addVertex(-nameWidth - 1, 8 + byte0, 0.0D); tessellator.addVertex(nameWidth + 1, 8 + byte0, 0.0D); tessellator.addVertex(nameWidth + 1, -1 + byte0, 0.0D); tessellator.draw(); GL11.glEnable(3553); font.drawString(name, -nameWidth, byte0, 553648127); GL11.glEnable(2929); GL11.glDepthMask(true); font.drawString(name, -nameWidth, byte0, -1); GL11.glEnable(2896); GL11.glDisable(3042); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:org.free.jake2.render.lwjgl.Light.java
License:Open Source License
/** * R_RenderDlights/*from w w w . j av a 2s.c om*/ */ void R_RenderDlights() { if (gl_flashblend.value == 0) { return; } r_dlightframecount = r_framecount + 1; // because the count hasn't // advanced yet for this frame GL11.glDepthMask(false); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); for (int i = 0; i < r_newrefdef.num_dlights; i++) { R_RenderDlight(r_newrefdef.dlights[i]); } GL11.glColor3f(1, 1, 1); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(true); }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_DrawEntitiesOnList//from ww w .j av a 2 s . c om */ void R_DrawEntitiesOnList() { if (r_drawentities.value == 0.0f) { return; } // draw non-transparent first int i; for (i = 0; i < r_newrefdef.num_entities; i++) { currententity = r_newrefdef.entities[i]; if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) { continue; // solid } if ((currententity.flags & Defines.RF_BEAM) != 0) { R_DrawBeam(currententity); } else { currentmodel = currententity.model; if (currentmodel == null) { R_DrawNullModel(); continue; } switch (currentmodel.type) { case mod_alias: R_DrawAliasModel(currententity); break; case mod_brush: R_DrawBrushModel(currententity); break; case mod_sprite: R_DrawSpriteModel(currententity); break; default: Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } } // draw transparent entities // we could sort these if it ever becomes a problem... GL11.glDepthMask(false); // no z writes for (i = 0; i < r_newrefdef.num_entities; i++) { currententity = r_newrefdef.entities[i]; if ((currententity.flags & Defines.RF_TRANSLUCENT) == 0) { continue; // solid } if ((currententity.flags & Defines.RF_BEAM) != 0) { R_DrawBeam(currententity); } else { currentmodel = currententity.model; if (currentmodel == null) { R_DrawNullModel(); continue; } switch (currentmodel.type) { case mod_alias: R_DrawAliasModel(currententity); break; case mod_brush: R_DrawBrushModel(currententity); break; case mod_sprite: R_DrawSpriteModel(currententity); break; default: Com.Error(Defines.ERR_DROP, "Bad modeltype"); break; } } } GL11.glDepthMask(true); // back to writing }
From source file:org.free.jake2.render.lwjgl.Main.java
License:Open Source License
/** * R_DrawBeam//from w w w. j a v a2 s. c o m */ 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); }
From source file:org.getspout.spout.gui.about.GuiAbout.java
License:LGPL
@Override public void drawScreen(int x, int y, float z) { super.drawBackground(0); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDisable(2912 /*GL_FOG*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bg.setTopColor(background1);//from w ww.ja v a 2s . c om bg.setBottomColor(background2); bg.setY(30); bg.setHeight(this.height - 50); bg.setX(0); bg.setWidth(this.width - 12); bg.render(); scrollArea.setY(30); scrollArea.setHeight(this.height - 50); scrollArea.setX(this.width - 12); scrollArea.setWidth(16); scrollArea.setTopColor(scrollBarColor); scrollArea.setBottomColor(scrollBarColor2); scrollArea.render(); drawScaledString("What is Spoutcraft?", this.width / 2 - 200, this.height, 0xffffff); drawScaledString("Spoutcraft is a modified Minecraft client", this.width / 2 - 200, this.height + 10, 0x808080); drawScaledString("that plays exactly like the official game.", this.width / 2 - 200, this.height + 20, 0x808080); drawScaledString("Its goal is to give modders an easy to", this.width / 2 - 200, this.height + 30, 0x808080); drawScaledString("use development platform for building", this.width / 2 - 200, this.height + 40, 0x808080); drawScaledString("and distributing mods, as well as a ", this.width / 2 - 200, this.height + 50, 0x808080); drawScaledString("providing a rich experience for players.", this.width / 2 - 200, this.height + 60, 0x808080); drawScaledString("What is Spout?", this.width / 2 - 200, this.height + 90, 0xffffff); drawScaledString("Spout is a Bukkit plugin that gives ", this.width / 2 - 200, this.height + 100, 0x808080); drawScaledString("developers an advanced server", this.width / 2 - 200, this.height + 110, 0x808080); drawScaledString("development platform that allows previouly ", this.width / 2 - 200, this.height + 120, 0x808080); drawScaledString("impossible tasks, such as custom items,", this.width / 2 - 200, this.height + 130, 0x808080); drawScaledString("blocks, mobs, animals, and vehicles. ", this.width / 2 - 200, this.height + 140, 0x808080); drawScaledString("Who is SpoutDev?", this.width / 2 - 200, this.height + 170, 0xffffff); drawScaledString("SpoutDev is the team behind Spout, ", this.width / 2 - 200, this.height + 180, 0x808080); drawScaledString("SpoutAPI, Spoutcraft and SpoutcraftAPI.", this.width / 2 - 200, this.height + 190, 0x808080); drawScaledString("Sponsors", this.width / 2 + 30, this.height, 0xffffff); drawScaledString("Team", this.width / 2 + 30, this.height + 90, 0xffffff); drawScaledString("Afforess - Lead Developer", this.width / 2 + 30, this.height + 100, 0x808080); drawScaledString("Wulfspider - Co-Lead & Support", this.width / 2 + 30, this.height + 110, 0x808080); drawScaledString("alta189 - Co-Lead & Developer", this.width / 2 + 30, this.height + 120, 0x808080); drawScaledString("Top_Cat - Developer", this.width / 2 + 30, this.height + 130, 0x808080); drawScaledString("Raphfrk - Developer", this.width / 2 + 30, this.height + 140, 0x808080); drawScaledString("narrowtux - Developer", this.width / 2 + 30, this.height + 150, 0x808080); drawScaledString("Olloth - Developer", this.width / 2 + 30, this.height + 160, 0x808080); drawScaledString("Email: dev@getspout.org", this.width / 2 + 30, this.height + 170, 0x808080); drawScaledString("Website: getspout.org", this.width / 2 + 30, this.height + 180, 0x808080); drawScaledString("IRC: #spout in Esper.net", this.width / 2 + 30, this.height + 190, 0x808080); drawScaledString("Move along, nothing to see here.", 40, this.height * 5, 0x808080); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int var11 = this.mc.renderEngine.getTexture("/gui/allitems.png"); this.mc.renderEngine.bindTexture(var11); RenderUtil.drawTexturedModalRectangle(this.width - 14, getInvertedScaledHeight(this.height - 5), 0, 208, 16, 16, 0f); GL11.glDisable(2912 /*GL_FOG*/); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); this.overlayBackground(0, 30, 255, 255); this.overlayBackground(this.height - 50, this.height, 255, 255); drawCenteredString(this.fontRenderer, "About", this.width / 2, 16, 0xffffff); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, this.mc.renderEngine.getTexture("/title/mclogo.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glScalef(0.4f, 0.4f, 0.4f); this.drawTexturedModalRect((int) (0.23f * this.width), (int) (this.height * 2.1f), 0, 0, 155, 44); this.drawTexturedModalRect((int) (0.23f * this.width) + 155, (int) (this.height * 2.1f), 0, 45, 155, 44); GL11.glScalef(1 / .4f, 1 / .4f, 1 / .4f); //undo scale above if (textureBinding != null) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((0.685f * this.width), (this.height * 0.83f), 0); // moves texture into place GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureBinding.getTextureID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, 32, -90, 0.0D, 0.0D); // draw corners tessellator.addVertexWithUV(128, 32, -90, textureBinding.getWidth(), 0.0D); tessellator.addVertexWithUV(128, 0.0D, -90, textureBinding.getWidth(), textureBinding.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, textureBinding.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } drawString(this.fontRenderer, "Beta 1.8.1", (int) (this.width * 0.097f), this.height - 20, 0xffffff); drawString(this.fontRenderer, "Copyright Mojang AB", (int) (this.width * 0.097f), this.height - 10, 0x808080); drawString(this.fontRenderer, SpoutClient.getClientVersion().toString(), (int) (this.width * 0.8713f), this.height - 20, 0xffffff); drawString(this.fontRenderer, "Licensed under LGPLv3", (int) (this.width * 0.695f), this.height - 10, 0x808080); getControlList().get(0).xPosition = this.width / 2 - 45; getControlList().get(0).yPosition = this.height - 25; getControlList().get(0).drawButton(this.mc, x, y); //super.drawScreen(x, x, z); //Shadow magic GL11.glEnable(3042 /*GL_BLEND*/); GL11.glBlendFunc(770, 771); GL11.glDisable(3008 /*GL_ALPHA_TEST*/); GL11.glShadeModel(7425 /*GL_SMOOTH*/); GL11.glDisable(3553 /*GL_TEXTURE_2D*/); Tessellator var16 = Tessellator.instance; byte var19 = 4; var16.startDrawingQuads(); var16.setColorRGBA_I(0, 0); var16.addVertexWithUV(0, (double) (30 + var19), 0.0D, 0.0D, 1.0D); var16.addVertexWithUV(this.width - 12, (double) (30 + var19), 0.0D, 1.0D, 1.0D); var16.setColorRGBA_I(0, 255); var16.addVertexWithUV(this.width - 12, 30, 0.0D, 1.0D, 0.0D); var16.addVertexWithUV(0, 30, 0.0D, 0.0D, 0.0D); var16.draw(); var16.startDrawingQuads(); var16.setColorRGBA_I(0, 255); var16.addVertexWithUV(0, this.height - 50, 0.0D, 0.0D, 1.0D); var16.addVertexWithUV(this.width - 12, this.height - 50, 0.0D, 1.0D, 1.0D); var16.setColorRGBA_I(0, 0); var16.addVertexWithUV(this.width - 12, (double) (this.height - 50 - var19), 0.0D, 1.0D, 0.0D); var16.addVertexWithUV(0, (double) (this.height - 50 - var19), 0.0D, 0.0D, 0.0D); var16.draw(); }
From source file:org.getspout.spout.gui.GenericTexture.java
License:Open Source License
@Override public void render() { String path = CustomTextureManager.getTextureFromUrl(getUrl()); if (path == null) { return;/* w w w .j ava2 s. c o m*/ } if (texture == null) { texture = CustomTextureManager.getTextureFromPath(path); if (texture == null) { return; } } GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) getScreenX(), (float) getScreenY(), 0); //moves texture into place GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, getHeight(), -90, 0.0D, 0.0D); //draw corners tessellator.addVertexWithUV(getWidth(), getHeight(), -90, texture.getWidth(), 0.0D); tessellator.addVertexWithUV(getWidth(), 0.0D, -90, texture.getWidth(), texture.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, texture.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }