List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java
License:Minecraft Mod Public
/** * ????GL./*from ww w . j a v a 2 s . c o m*/ */ public static void beginRendering() { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glDepthMask(false); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); }
From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java
License:Minecraft Mod Public
/** * ???GL./*w ww . java 2 s . com*/ */ public static void endRendering() { GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:net.awairo.mcmod.spawnchecker.client.mode.information.Renderer.java
License:Minecraft Mod Public
/** * ?????./* www . ja va2 s . c om*/ */ void draw(int posX, int posY, Mode.Information info) { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glDepthMask(false); final int rgb = rgbOf(info.intColor()); int a = alpha == 1.0f ? alphaOf(info.intColor()) : Math.max(Math.round(alphaOf(info.intColor()) * alpha), MIN_ALPHA); if (info.hasIcon()) drawIcon(posX, posY, info, rgb, a); drawString(posX, posY, info, rgb | a << 24); GL11.glDisable(GL11.GL_BLEND); }
From source file:net.cortexmodders.lyoko.client.render.RenderUtil.java
License:MIT License
public static void renderWireframe(AxisAlignedBB box) { // render wireframe GL11.glPushMatrix();/* w w w.ja v a 2 s . c o m*/ GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); GL11.glLineWidth(2.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(3); tessellator.addVertex(box.minX, box.minY, box.minZ); tessellator.addVertex(box.maxX, box.minY, box.minZ); tessellator.addVertex(box.maxX, box.minY, box.maxZ); tessellator.addVertex(box.minX, box.minY, box.maxZ); tessellator.addVertex(box.minX, box.minY, box.minZ); tessellator.draw(); tessellator.startDrawing(3); tessellator.addVertex(box.minX, box.maxY, box.minZ); tessellator.addVertex(box.maxX, box.maxY, box.minZ); tessellator.addVertex(box.maxX, box.maxY, box.maxZ); tessellator.addVertex(box.minX, box.maxY, box.maxZ); tessellator.addVertex(box.minX, box.maxY, box.minZ); tessellator.draw(); tessellator.startDrawing(1); tessellator.addVertex(box.minX, box.minY, box.minZ); tessellator.addVertex(box.minX, box.maxY, box.minZ); tessellator.addVertex(box.maxX, box.minY, box.minZ); tessellator.addVertex(box.maxX, box.maxY, box.minZ); tessellator.addVertex(box.maxX, box.minY, box.maxZ); tessellator.addVertex(box.maxX, box.maxY, box.maxZ); tessellator.addVertex(box.minX, box.minY, box.maxZ); tessellator.addVertex(box.minX, box.maxY, box.maxZ); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:net.lyonlancer5.mcmp.karasu.client.renderer.tileentity.TileEntityBeaconRenderer.java
License:Apache License
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTickTime) { TileEntityBeacon beacon = (TileEntityBeacon) tile; float f1 = beacon.func_146002_i(); //OpenGLHelper.alphaFunc(GL11.GL_GREATER, 0.1F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if (f1 > 0.0F) { Tessellator tessellator = Tessellator.instance; List<BeamSegment> list = beacon.getSegments(); int j = 0; for (int i = 0; i < list.size(); i++) { BeamSegment beamsegment = list.get(i); int l = j + beamsegment.getCurrentSegment(); bindTexture(BEAM_TEXTURE);/*w w w . j a va 2s . c o m*/ GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); //OpenGLHelper.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //OpenGLHelper.disableCull(); GL11.glDisable(GL11.GL_CULL_FACE); //OpenGLHelper.disableBlend(); GL11.glDisable(GL11.GL_BLEND); //OpenGLHelper.depthMask(true); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = tile.getWorldObj().getTotalWorldTime() + partialTickTime; float f3 = -f2 * 0.2F - MathHelper.floor_float(-f2 * 0.1F); double d3 = f2 * 0.025D * -1.5D; tessellator.startDrawingQuads(); double d4 = 0.2D; double d5 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d4; double d6 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d4; double d7 = 0.5D + Math.cos(d3 + Math.PI / 4D) * d4; double d8 = 0.5D + Math.sin(d3 + Math.PI / 4D) * d4; double d9 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d4; double d10 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d4; double d11 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d4; double d12 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d4; double d13 = 0.0D; double d14 = 1.0D; double d15 = -1.0F + f3; double d16 = beamsegment.getCurrentSegment() * f1 * (0.5D / d4) + d15; tessellator.setColorRGBA_F(beamsegment.getSegmentColors()[0], beamsegment.getSegmentColors()[1], beamsegment.getSegmentColors()[2], 0.125F); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d14, d16); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d14, d15); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d13, d15); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d13, d16); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d14, d16); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d14, d15); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d13, d15); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d13, d16); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d14, d16); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d14, d15); tessellator.addVertexWithUV(x + d11, y + j, z + d12, d13, d15); tessellator.addVertexWithUV(x + d11, y + l, z + d12, d13, d16); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d14, d16); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d14, d15); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d13, d15); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d13, d16); tessellator.draw(); //OpenGLHelper.enableBlend(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); //OpenGLHelper.depthMask(false); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA_F(beamsegment.getSegmentColors()[0], beamsegment.getSegmentColors()[1], beamsegment.getSegmentColors()[2], 0.125F); d3 = 0.2D; d4 = 0.2D; d5 = 0.8D; d6 = 0.2D; d7 = 0.2D; d8 = 0.8D; d9 = 0.8D; d10 = 0.8D; d11 = 0.0D; d12 = 1.0D; d13 = -1.0F + f3; d14 = beamsegment.getCurrentSegment() * f1 + d13; tessellator.addVertexWithUV(x + d3, y + l, z + d4, d12, d14); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d12, d13); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d11, d13); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d11, d14); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d12, d14); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d12, d13); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d11, d13); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d11, d14); tessellator.addVertexWithUV(x + d5, y + l, z + d6, d12, d14); tessellator.addVertexWithUV(x + d5, y + j, z + d6, d12, d13); tessellator.addVertexWithUV(x + d9, y + j, z + d10, d11, d13); tessellator.addVertexWithUV(x + d9, y + l, z + d10, d11, d14); tessellator.addVertexWithUV(x + d7, y + l, z + d8, d12, d14); tessellator.addVertexWithUV(x + d7, y + j, z + d8, d12, d13); tessellator.addVertexWithUV(x + d3, y + j, z + d4, d11, d13); tessellator.addVertexWithUV(x + d3, y + l, z + d4, d11, d14); tessellator.draw(); //OpenGLHelper.enableLighting(); GL11.glEnable(GL11.GL_LIGHTING); //OpenGLHelper.enableTexture2D(); GL11.glEnable(GL11.GL_TEXTURE_2D); //OpenGLHelper.depthMask(true); j = l; } } }
From source file:net.minecraft.client.gui.GuiAchievement.java
public void updateAchievementWindow() { if (Minecraft.hasPaidCheckTime > 0L) { GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); RenderHelper.disableStandardItemLighting(); this.updateAchievementWindowScale(); String var1 = "Minecraft Beta 1.7.3 Unlicensed Copy :("; String var2 = "(Or logged in from another location)"; String var3 = "Purchase at minecraft.net"; this.theGame.fontRenderer.drawStringWithShadow(var1, 2, 2, 16777215); this.theGame.fontRenderer.drawStringWithShadow(var2, 2, 11, 16777215); this.theGame.fontRenderer.drawStringWithShadow(var3, 2, 20, 16777215); GL11.glDepthMask(true);/*from w ww.j a va2s . co m*/ GL11.glEnable(2929 /*GL_DEPTH_TEST*/); } if (this.theAchievement != null && this.achievementTime != 0L) { double var8 = (double) (System.currentTimeMillis() - this.achievementTime) / 3000.0D; if (!this.haveAchiement && !this.haveAchiement && (var8 < 0.0D || var8 > 1.0D)) { this.achievementTime = 0L; } else { this.updateAchievementWindowScale(); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); double var9 = var8 * 2.0D; if (var9 > 1.0D) { var9 = 2.0D - var9; } var9 *= 4.0D; var9 = 1.0D - var9; if (var9 < 0.0D) { var9 = 0.0D; } var9 *= var9; var9 *= var9; int var5 = this.achievementWindowWidth - 160; int var6 = 0 - (int) (var9 * 36.0D); int var7 = this.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*/, var7); GL11.glDisable(2896 /*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); } GL11.glPushMatrix(); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glEnable('\u803a'); GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/); GL11.glEnable(2896 /*GL_LIGHTING*/); this.itemRender.renderItemIntoGUI(this.theGame.fontRenderer, this.theGame.renderEngine, this.theAchievement.theItemStack, var5 + 8, var6 + 8); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); } } }
From source file:net.minecraft.src.GuiAchievement.java
public void updateAchievementWindow() { if (Minecraft.hasPaidCheckTime > 0L) { GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); RenderHelper.disableStandardItemLighting(); this.updateAchievementWindowScale(); String var1 = "Minecraft Beta 1.7.3 Unlicensed Copy :("; String var2 = "(Or logged in from another location)"; String var3 = "Purchase at minecraft.net"; this.theGame.fontRenderer.drawStringWithShadow(var1, 2, 2, 16777215); this.theGame.fontRenderer.drawStringWithShadow(var2, 2, 11, 16777215); this.theGame.fontRenderer.drawStringWithShadow(var3, 2, 20, 16777215); GL11.glDepthMask(true);/* ww w.j a va 2 s . c o m*/ GL11.glEnable(2929 /*GL_DEPTH_TEST*/); } if (this.theAchievement != null && this.field_25083_f != 0L || customNotification) { //Spout //Spout Start double delayTime = 3000; if (customNotification) { if (time < 1) { delayTime = 7500; } else { delayTime = time; } } double var8 = (double) (System.currentTimeMillis() - this.field_25083_f) / delayTime; //Spout End if (!this.field_27103_i && !this.field_27103_i && (var8 < 0.0D || var8 > 1.0D)) { this.field_25083_f = 0L; } else { this.updateAchievementWindowScale(); GL11.glDisable(2929 /*GL_DEPTH_TEST*/); GL11.glDepthMask(false); double var9 = var8 * 2.0D; if (var9 > 1.0D) { var9 = 2.0D - var9; } var9 *= 4.0D; var9 = 1.0D - var9; if (var9 < 0.0D) { var9 = 0.0D; } var9 *= var9; var9 *= var9; int var5 = this.achievementWindowWidth - 160; int var6 = 0 - (int) (var9 * 36.0D); int var7 = this.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*/, var7); GL11.glDisable(2896 /*GL_LIGHTING*/); this.drawTexturedModalRect(var5, var6, 96, 202, 160, 32); if (this.field_27103_i) { this.theGame.fontRenderer.func_27278_a(this.field_25084_e, var5 + 30, var6 + 7, 120, -1); } else { this.theGame.fontRenderer.drawString(this.field_25085_d, var5 + 30, var6 + 7, -256); this.theGame.fontRenderer.drawString(this.field_25084_e, var5 + 30, var6 + 18, -1); } GL11.glPushMatrix(); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glEnable('\u803a'); GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/); GL11.glEnable(2896 /*GL_LIGHTING*/); //Spout Start ItemStack toRender = theAchievement != null ? theAchievement.theItemStack : null; if (customNotification) { if (data < 1) { toRender = new ItemStack(itemId, 1, 0); } else { toRender = new ItemStack(itemId, 1, data); } } if (toRender != null) { itemRender.renderItemIntoGUI(theGame.fontRenderer, theGame.renderEngine, toRender, var5 + 8, var6 + 8); } //Spout End GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDepthMask(true); GL11.glEnable(2929 /*GL_DEPTH_TEST*/); } } }
From source file:net.minecraft.src.wirelessredstone.presentation.TileEntityRedstoneWirelessRenderer.java
License:Open Source License
private void renderFreq(TileEntityRedstoneWireless tileentity) { FontRenderer fontrenderer = getFontRenderer(); String s = tileentity.getFreq() + ""; GL11.glDepthMask(false); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 50, 0); GL11.glDepthMask(true);/* w ww . jav a 2s . c o m*/ // GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:net.neilcsmith.praxis.video.opengl.internal.GLRenderer.java
License:Apache License
private void activate() { if (active) { return;// w w w .j a v a2s .co m } GL11.glDepthMask(false); GL11.glEnable(GL11.GL_TEXTURE_2D); FrameBuffer fbo = null; boolean clear = false; target = null; if (surface != null) { GLSurfaceData data = surface.getData(); if (data == null) { LOGGER.finest("Setting up render to empty surface"); data = new GLSurfaceData(surface.getWidth(), surface.getHeight(), surface.hasAlpha()); data.texture = context.getTextureManager().acquire(data.width, data.height); surface.setData(data); clear = true; } else if (data.usage > 1) { LOGGER.finest("Setting up render to shared surface"); data.usage--; if (data.texture == null) { data.texture = context.getTextureManager().acquire(data.width, data.height); syncPixelsToTexture(data); } data.texture.getFrameBuffer().bind(); data = new GLSurfaceData(surface.getWidth(), surface.getHeight(), surface.hasAlpha()); data.texture = context.getTextureManager().acquire(data.width, data.height); data.texture.bind(); GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, data.width, data.height); surface.setData(data); } else if (data.texture == null) { LOGGER.finest("Setting up render to pixel backed surface"); data.texture = context.getTextureManager().acquire(data.width, data.height); syncPixelsToTexture(data); } data.pixels = null; target = data.texture; fbo = data.texture.getFrameBuffer(); } GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); if (fbo == null) { LOGGER.finest("Setting up render to screen"); int w = GLContext.getCurrent().getWidth(); int h = GLContext.getCurrent().getHeight(); FrameBuffer.unbind(); GL11.glViewport(0, 0, w, h); projectionMatrix.setToOrtho2D(0, 0, w, h); } else { LOGGER.finest("Setting up render to texture"); fbo.bind(); int w = surface.getWidth(); int h = surface.getHeight(); GL11.glViewport(0, 0, w, h); projectionMatrix.setToOrtho2D(0, h, w, -h); } if (customShader != null) { customShader.begin(); } else { shader.begin(); } setupMatrices(); active = true; if (clear) { clear(); } }
From source file:net.slimevoid.wirelessredstone.client.presentation.TileEntityRedstoneWirelessRenderer.java
License:Open Source License
private void renderFreq(TileEntityRedstoneWireless tileentity) { FontRenderer fontrenderer = this.func_147498_b();// getFontRenderer(); String s = String.valueOf(tileentity.getFreq()) + ""; GL11.glDepthMask(false); fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 50, 0); GL11.glDepthMask(true);//from w w w . j a va 2s .c om // GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }