List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:hellfirepvp.astralsorcery.client.effect.light.EffectLightbeam.java
License:Open Source License
public static void renderFast(List<EffectLightbeam> beams) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix();/*from w w w . ja v a 2s .co m*/ GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); SpriteLibrary.spriteLightbeam.getResource().bind(); //RenderingUtils.removeStandartTranslationFromTESRMatrix(Minecraft.getMinecraft().getRenderPartialTicks()); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); Entity rView = Minecraft.getMinecraft().getRenderViewEntity(); if (rView == null) rView = Minecraft.getMinecraft().player; for (EffectLightbeam beam : beams) { if (rView.getDistanceSq(beam.from.getX(), beam.from.getY(), beam.from.getZ()) > Config.maxEffectRenderDistanceSq) return; beam.renderFast(vb); } t.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:hellfirepvp.astralsorcery.client.effect.light.EffectLightbeam.java
License:Open Source License
@Override public void render(float pTicks) { Entity rView = Minecraft.getMinecraft().getRenderViewEntity(); if (rView == null) rView = Minecraft.getMinecraft().player; if (rView.getDistanceSq(from.getX(), from.getY(), from.getZ()) > Config.maxEffectRenderDistanceSq) return;/*from w ww .j a v a 2 s. c om*/ float tr = alphaFunction.getAlpha(age, maxAge); tr *= 0.6; tr *= alphaMultiplier; GL11.glPushMatrix(); removeOldTranslate(rView, pTicks); GL11.glColor4f(cR * tr, cG * tr, cB * tr, cA * tr); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_ALPHA_TEST); Blending.PREALPHA.apply(); boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING); if (lighting) { GL11.glDisable(GL11.GL_LIGHTING); } SpriteLibrary.spriteLightbeam.getResource().bind(); renderCurrentTextureAroundAxis(Math.toRadians(0F)); renderCurrentTextureAroundAxis(Math.toRadians(120F)); renderCurrentTextureAroundAxis(Math.toRadians(240F)); if (lighting) { GL11.glEnable(GL11.GL_LIGHTING); } Blending.DEFAULT.apply(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.gui.journal.GuiProgressionClusterRenderer.java
License:Open Source License
private void renderNodeToGUI(ResearchNode node, double lowerPosX, double lowerPosY, float zLevel) { double scaledLeft = this.mousePointScaled.getScaledPosX() - partSizeHandler.widthToBorder; double scaledTop = this.mousePointScaled.getScaledPosY() - partSizeHandler.heightToBorder; double xAdd = lowerPosX - scaledLeft; double yAdd = lowerPosY - scaledTop; double offsetX = renderOffsetX + xAdd; double offsetY = renderOffsetY + yAdd; GL11.glPushMatrix();//from w w w . j a va 2 s . c o m GL11.glDepthMask(true); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); /*if(node.isSpecial()) { frameWooden.bind(); } else { frameBlank.bind(); }*/ frameWooden.bind(); double zoomedWH = partSizeHandler.getZoomedWHNode(); if (partSizeHandler.getScalingFactor() >= 0.7) { clickableNodes.put(new Rectangle(MathHelper.floor(offsetX), MathHelper.floor(offsetY), MathHelper.floor(zoomedWH), MathHelper.floor(zoomedWH)), node); } drawResearchItemBackground(zoomedWH, xAdd, yAdd, zLevel); TextureHelper.refreshTextureBindState(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(offsetX, offsetY, 0); RenderItem ri = Minecraft.getMinecraft().getRenderItem(); Tessellator t = Tessellator.getInstance(); VertexBuffer vb = t.getBuffer(); switch (node.getRenderType()) { case ITEMSTACK: GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); RenderHelper.enableGUIStandardItemLighting(); GL11.glPushMatrix(); GL11.glScaled(partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor(), partSizeHandler.getScalingFactor()); GL11.glTranslated(3, 3, 3); GL11.glScaled(0.75, 0.75, 0.75); GL11.glColor4f(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); float oldZ = ri.zLevel; ri.zLevel = zLevel - 5; ri.renderItemIntoGUI(node.getRenderItemStack(ClientScheduler.getClientTick()), 0, 0); ri.zLevel = oldZ; GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glPopAttrib(); break; case TEXTURE: GlStateManager.disableAlpha(); GlStateManager.color(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); BindableResource tex = node.getTexture().resolve(); tex.bind(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, zoomedWH - 1, zLevel).tex(0, 1).endVertex(); vb.pos(zoomedWH - 1, zoomedWH - 1, zLevel).tex(1, 1).endVertex(); vb.pos(zoomedWH - 1, 0, zLevel).tex(1, 0).endVertex(); vb.pos(0, 0, zLevel).tex(0, 0).endVertex(); t.draw(); GlStateManager.color(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); GlStateManager.enableAlpha(); break; case TEXTURE_SPRITE: GlStateManager.disableAlpha(); GL11.glDisable(GL11.GL_ALPHA_TEST); GlStateManager.color(renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor, renderLoopBrFactor); SpriteSheetResource res = node.getSpriteTexture().resolveSprite(); res.getResource().bind(); Tuple<Double, Double> uvTexture = res.getUVOffset(ClientScheduler.getClientTick()); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); vb.pos(0, zoomedWH, zLevel).tex(uvTexture.key, uvTexture.value + res.getVLength()).endVertex(); vb.pos(zoomedWH, zoomedWH, zLevel) .tex(uvTexture.key + res.getULength(), uvTexture.value + res.getVLength()).endVertex(); vb.pos(zoomedWH, 0, zLevel).tex(uvTexture.key + res.getULength(), uvTexture.value).endVertex(); vb.pos(0, 0, zLevel).tex(uvTexture.key, uvTexture.value).endVertex(); t.draw(); GlStateManager.color(1F, 1F, 1F, 1F); TextureHelper.refreshTextureBindState(); GlStateManager.enableAlpha(); break; } GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.util.RenderingUtils.java
License:Open Source License
public static void renderLightRayEffects(double x, double y, double z, Color effectColor, long seed, long continuousTick, int dstJump, float scale, int countFancy, int countNormal) { rand.setSeed(seed);/*from w w w.ja v a2 s .c om*/ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); int fancy_count = !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics ? countNormal : countFancy; Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); RenderHelper.disableStandardItemLighting(); float f1 = continuousTick / 400.0F; float f2 = 0.4F; 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.glDepthMask(false); GL11.glPushMatrix(); for (int i = 0; i < fancy_count; i++) { GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F + f1 * 360.0F, 0.0F, 0.0F, 1.0F); vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); float fa = rand.nextFloat() * 20.0F + 5.0F + f2 * 10.0F; float f4 = rand.nextFloat() * 2.0F + 1.0F + f2 * 2.0F; fa /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F); f4 /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F); vb.pos(0, 0, 0).color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), (int) (255.0F * (1.0F - f2))).endVertex(); vb.pos(-0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(0.0D, fa, 1.0F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(-0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); tes.draw(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); 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(); GL11.glPopMatrix(); }
From source file:illarion.graphics.lwjgl.MaskUtilLWJGL.java
License:Open Source License
/** * Start defining a mask. After calling this you need to use the drawer * functions to mask out the needed areas. */// w w w . j a va2 s. c om @Override public void defineMask() { GL11.glDepthMask(true); GL11.glClearDepth(1); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); GL11.glDepthFunc(GL11.GL_ALWAYS); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glColorMask(false, false, false, false); }
From source file:illarion.graphics.lwjgl.MaskUtilLWJGL.java
License:Open Source License
/** * Finish defining the mask. After this all render actions become visible on * the screen again. The mask is finished after this operation. Its not * possible anymore to mask out more areas. *//* ww w .j av a 2s. c o m*/ @Override public void finishDefineMask() { GL11.glDepthMask(false); GL11.glColorMask(true, true, true, true); }
From source file:info.plugmania.novacraft.event.gui.Render3DHUDEvent.java
License:GNU General Public License
public void enable() { GL11.glPushMatrix();//from www . j a v a 2s . c o m GL11.glDepthMask(true); //GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glEnable(GL11.GL_LINE_SMOOTH); Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D); }
From source file:info.plugmania.novacraft.event.gui.Render3DHUDEvent.java
License:GNU General Public License
public void disable() { Minecraft.getMinecraft().entityRenderer.enableLightmap(1.0D); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST);//from w ww .j a va 2 s . c o m GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }
From source file:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java
License:GNU General Public License
public void enable() { GL11.glPushMatrix();/* w w w.j a va2 s. co m*/ GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); ; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(770, 771); GL11.glEnable(GL11.GL_LINE_SMOOTH); Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D); }
From source file:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java
License:GNU General Public License
public void disable() { Minecraft.getMinecraft().entityRenderer.enableLightmap(1.0D); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST);// www .j a v a 2 s . c o m GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); }