List of usage examples for org.lwjgl.opengl GL11 GL_ZERO
int GL_ZERO
To view the source code for org.lwjgl.opengl GL11 GL_ZERO.
Click Source Link
From source file:de.sanandrew.core.manpack.mod.client.gui.GuiUpdateDetails.java
License:Creative Commons License
@Override public void drawScreen(int mouseX, int mouseY, float partTicks) { int xPos = (this.width - 276) / 2; int yPos = (this.height - 240) / 2; int listX = 16; int listY = 60; int listWidth = 244; int listHeight = 150; int listTextY = 5; String s;/*from ww w . j a v a 2s .c o m*/ boolean isLeftMBDown = Mouse.isButtonDown(0); int scrollX = xPos + listX + listWidth - 4; int scrollY = yPos + listY; if (!this.isScrolling && isLeftMBDown && mouseX >= scrollX && mouseY >= scrollY && mouseX < scrollX + 4 && mouseY < scrollY + listHeight) { this.isScrolling = this.scrollMax > 0.0F; } if (!isLeftMBDown) { this.isScrolling = false; } if (this.isScrolling) { this.scrollAmount = Math.min(this.scrollMax, Math.max(0.0F, (mouseY - scrollY - 5) / (listHeight - 10.0F)) * scrollMax); } this.drawDefaultBackground(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); Gui.drawRect(xPos, 0, xPos + 276, this.height, 0x80000000); GuiUtils.drawGradientRect(xPos, 0, xPos + 5, this.height, 0xFF000000, 0x00000000, this.zLevel); GuiUtils.drawGradientRect(xPos + 271, 0, xPos + 276, this.height, 0x00000000, 0xFF000000, this.zLevel); GL11.glPushMatrix(); GL11.glTranslatef(16.0F, 4.0F, 0.0F); GL11.glScalef(1.5F, 1.5F, 1.0F); GL11.glTranslatef(xPos / 1.5F - xPos, yPos / 1.5F - yPos, 0.0F); this.fontRendererObj.drawString(this.manager.getModName(), xPos, yPos, 0xFFFFFFFF); GL11.glPopMatrix(); s = "Currently installed version"; this.fontRendererObj.drawString(s, xPos + 16, yPos + 22, 0xFFA0A0A0); Gui.drawRect(xPos + this.fontRendererObj.getStringWidth(s) + 18, yPos + 26, xPos + 160, yPos + 27, 0xFF606060); s = "Updated version"; this.fontRendererObj.drawString(s, xPos + 16, yPos + 32, 0xFFA0A0A0); Gui.drawRect(xPos + this.fontRendererObj.getStringWidth(s) + 18, yPos + 36, xPos + 160, yPos + 37, 0xFF606060); this.fontRendererObj.drawString(this.manager.getVersion().toString(), xPos + 162, yPos + 22, 0xFFFFFFFF); this.fontRendererObj.drawString(this.manager.getUpdateInfo().version, xPos + 162, yPos + 32, 0xFFFFFFFF); this.fontRendererObj.drawString("Details and Changelog:", xPos + 16, yPos + 48, 0xFFA0A0A0); this.mc.renderEngine.bindTexture(TEXTURE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.drawTexturedModalRect(xPos + listX - 1, yPos + listY - 1, 0, 0, listWidth + 2, listHeight + 2); GuiUtils.doGlScissor(xPos + listX, yPos + listY, listWidth, listHeight); GL11.glEnable(GL11.GL_SCISSOR_TEST); GL11.glPushMatrix(); GL11.glTranslatef(0.0F, -this.scrollAmount, 0.0F); s = this.manager.getUpdateInfo().description; this.fontRendererObj.drawSplitString(s, xPos + listX + 4, yPos + listY + listTextY + 2, listWidth - 12, 0xFFA00060); listTextY += this.fontRendererObj.splitStringWidth(s, listWidth - 12) + 4; if (this.manager.getUpdateInfo().changelog != null) { for (int i = 0; i < this.manager.getUpdateInfo().changelog.length; i++) { s = this.manager.getUpdateInfo().changelog[i]; Gui.drawRect(xPos + listX + 4, yPos + listY + listTextY + 4, xPos + listX + 8, yPos + listY + listTextY + 8, i % 2 == 0 ? 0xFF000000 : 0xFF606060); this.fontRendererObj.drawSplitString(s, xPos + listX + 14, yPos + listY + listTextY + 2, listWidth - 22, i % 2 == 0 ? 0xFF000000 : 0xFF606060); listTextY += this.fontRendererObj.splitStringWidth(s, listWidth - 22) + 2; } } this.scrollMax = listTextY - listHeight + 4; GL11.glPopMatrix(); GL11.glDisable(GL11.GL_SCISSOR_TEST); this.mc.renderEngine.bindTexture(TEXTURE); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int scrollPos = (int) (this.scrollAmount / this.scrollMax * (listHeight - 10.0F)); this.drawTexturedModalRect(xPos + listX + listWidth - 4, yPos + listY + scrollPos, listWidth + 2, 0, 4, 10); GL11.glDisable(GL11.GL_BLEND); super.drawScreen(mouseX, mouseY, partTicks); }
From source file:de.sanandrew.core.manpack.mod.client.particle.SAPEffectRenderer.java
License:Creative Commons License
public void renderParticles(Entity viewingEntity, float partTicks, boolean alpha) { float rotX = ActiveRenderInfo.rotationX; float rotZ = ActiveRenderInfo.rotationZ; float rotYZ = ActiveRenderInfo.rotationYZ; float rotXY = ActiveRenderInfo.rotationXY; float rotXZ = ActiveRenderInfo.rotationXZ; EntityFX.interpPosX = viewingEntity.lastTickPosX + (viewingEntity.posX - viewingEntity.lastTickPosX) * partTicks; EntityFX.interpPosY = viewingEntity.lastTickPosY + (viewingEntity.posY - viewingEntity.lastTickPosY) * partTicks; EntityFX.interpPosZ = viewingEntity.lastTickPosZ + (viewingEntity.posZ - viewingEntity.lastTickPosZ) * partTicks; Collection<Entry<Integer, Pair<ResourceLocation, Boolean>>> currLayers = Collections2 .filter(this.fxLayers.entrySet(), new SortingFilter(alpha)); for (Entry<Integer, Pair<ResourceLocation, Boolean>> layer : currLayers) { Pair<ResourceLocation, Boolean> layerData = layer.getValue(); Collection<EntityParticle> particles = this.particles.get(layer.getKey()); if (!particles.isEmpty()) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); for (final EntityParticle particle : particles) { if (particle == null) { continue; }/*from w ww . ja v a 2 s. c om*/ tessellator.setBrightness(particle.getBrightnessForRender(partTicks)); try { particle.renderParticle(tessellator, partTicks, rotX, rotXZ, rotZ, rotYZ, rotXY); } catch (Throwable throwable) { throw new RuntimeException("Couldn't render particle!", throwable); } } this.textureManager.bindTexture(layerData.getValue0()); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (layerData.getValue1()) { GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); } SAPUtils.EVENT_BUS.post(new SAPFxLayerRenderEvent.Pre(layer.getKey(), tessellator)); tessellator.draw(); SAPUtils.EVENT_BUS.post(new SAPFxLayerRenderEvent.Post(layer.getKey())); if (layerData.getValue1()) { GL11.glDisable(GL11.GL_BLEND); } } } }
From source file:de.sanandrew.core.manpack.mod.client.UpdateOverlayManager.java
License:Creative Commons License
public void renderInfobox() { if (this.mc == null || this.fontRenderer == null) { this.mc = Minecraft.getMinecraft(); this.fontRenderer = new FontRenderer(this.mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.mc.renderEngine, true); this.timer.elapsedTicks = -1; }//w w w . ja v a 2 s . c o m if (this.counter == 0 && this.scale <= 0.00F) { return; } this.fontRenderer.setBidiFlag(this.mc.fontRenderer.getBidiFlag()); String update = this.updateMods.get(this.currMod).getValue0().getModName() + " update out!"; String version = "new version: " + this.updateMods.get(this.currMod).getValue1(); String details = "press \247f[" + Keyboard.getKeyName(ClientProxy.KEY_UPDATE_GUI.getKeyCode()) + "]\247r for details"; this.mc.renderEngine.bindTexture(this.frameTex); int width = Math.max(this.fontRenderer.getStringWidth(update), Math.max(this.fontRenderer.getStringWidth(version), this.fontRenderer.getStringWidth(details))) + 12; int height = 45; GL11.glPushMatrix(); GL11.glScalef(this.scale, this.scale, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPushMatrix(); GL11.glScalef(1.0F / 256.0F * 16, 1.0F / 256.0F * 16, 1.0F); this.drawTexturedModalRect(0, 0, 0, 0, width * 16, 4 * 16); this.drawTexturedModalRect(0, 4 * 16, 0, 4 * 16, 4 * 16, (height - 8) * 16); this.drawTexturedModalRect(0, (height - 4) * 16, 0, (height - 4) * 16, width * 16, 4 * 16); this.drawTexturedModalRect((width - 4) * 16, 4 * 16, 0, 4 * 16, 4 * 16, (height - 8) * 16); GL11.glPopMatrix(); drawRect(1, 1, width - 1, height - 1, 0x80000000); GL11.glPopMatrix(); if (this.scale >= 1.00F && this.counter > 0) { if (!this.mc.isGamePaused()) { this.timer.updateTimer(); } int alpha = ((int) (Math.abs(this.txtFade) * 255.0F) & 255) << 24; GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); if (alpha != 0) { this.drawCenteredString(this.fontRenderer, update, width / 2, 5, 0xFFFF00 | alpha); this.drawCenteredString(this.fontRenderer, version, width / 2, 12, 0xA0A0A0 | alpha); } GL11.glDisable(GL11.GL_BLEND); this.drawCenteredString(this.fontRenderer, details, width / 2, 30, 0xA0A0A0); this.drawCenteredString(this.fontRenderer, Integer.toString(this.counter), width / 2, height - 4, 0xFFFFFF); } else if (this.counter > 0) { this.scale += 0.1F; } else if (this.scale > 0.00F) { this.scale -= 0.1F; } if (Math.abs(this.txtFade) < 0.01F) { this.currMod++; this.txtFade -= 0.1F; } else if (Math.abs(this.txtFade) < 1.00F) { this.txtFade -= 0.1F; } else if (this.txtFade <= -1.00F) { this.txtFade = 1.00F; } if (this.timer.elapsedTicks > 0 && this.counter > 0) { this.counter--; if (this.counter > 0 && this.counter % 5 == 0) { this.txtFade -= 0.1F; } this.timer.elapsedTicks = 0; } }
From source file:de.sanandrew.core.manpack.util.client.helpers.GuiUtils.java
License:Creative Commons License
public static void drawGuiIcon(IIcon icon, int posX, int posY) { GL11.glPushMatrix();//from w w w.ja v a 2 s . c om GL11.glTranslatef(0.0F, 0.0F, 32.0F); itemRenderer.zLevel = 200.0F; 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_ALPHA_TEST); ResourceLocation resourcelocation = Minecraft.getMinecraft().getTextureManager().getResourceLocation(1); Minecraft.getMinecraft().getTextureManager().bindTexture(resourcelocation); if (icon == null) { icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)) .getAtlasSprite("missingno"); } itemRenderer.renderIcon(posX, posY, icon, 16, 16); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); itemRenderer.zLevel = 0.0F; GL11.glPopMatrix(); }
From source file:de.sanandrew.core.manpack.util.client.helpers.SAPClientUtils.java
License:Creative Commons License
public static void drawSquareXNeg(double cornerBeginY, double cornerBeginZ, double cornerEndY, double cornerEndZ, double x) { Tessellator tess = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND);/*from w w w . j a v a2 s .c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); tess.startDrawingQuads(); tess.setNormal(-1.0F, 0.0F, 0.0F); tess.addVertex(x, cornerBeginY, cornerBeginZ); tess.addVertex(x, cornerBeginY, cornerEndZ); tess.addVertex(x, cornerEndY, cornerEndZ); tess.addVertex(x, cornerEndY, cornerBeginZ); tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:de.sanandrew.core.manpack.util.client.helpers.SAPClientUtils.java
License:Creative Commons License
public static void drawSquareZPos(double cornerBeginX, double cornerBeginY, double cornerEndX, double cornerEndY, double z) { Tessellator tess = Tessellator.instance; GL11.glEnable(GL11.GL_BLEND);//from ww w.ja va2 s.co m GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); tess.startDrawingQuads(); tess.setNormal(0.0F, 0.0F, 1.0F); tess.addVertex(cornerBeginX, cornerBeginY, z); tess.addVertex(cornerEndX, cornerBeginY, z); tess.addVertex(cornerEndX, cornerEndY, z); tess.addVertex(cornerBeginX, cornerEndY, z); tess.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:de.sanandrew.mods.claysoldiers.client.event.SoldierBodyRenderHandler.java
License:Creative Commons License
private void renderThunderbolt(EntityClayMan clayMan, double targetX, double targetY, double targetZ) { NBTTagCompound effectNbt = clayMan.getEffect(SoldierEffects.EFF_THUNDER).getNbtTag(); if (effectNbt.getShort("ticksRemaining") < 17) { return;/*from www.j a v a 2s .com*/ } double originX = effectNbt.getDouble("originX") - clayMan.posX + targetX; double originY = effectNbt.getDouble("originY") - clayMan.posY + targetY; double originZ = effectNbt.getDouble("originZ") - clayMan.posZ + targetZ; List<Triplet<Double, Double, Double>> randCoords = new ArrayList<>(); randCoords.add(Triplet.with(0.0D, 0.0D, 0.0D)); this.p_thunderboldRNG.setSeed(effectNbt.getLong("randomLightning")); int size = this.p_thunderboldRNG.nextInt(5) + 6; for (int i = 0; i < size; i++) { randCoords.add(Triplet.with(this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D, this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D, this.p_thunderboldRNG.nextDouble() * 0.5D - 0.25D)); } randCoords.add(Triplet.with(0.0D, 0.25D, 0.0D)); size++; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glShadeModel(GL11.GL_SMOOTH); float prevLightX = OpenGlHelper.lastBrightnessX; float prevLightY = OpenGlHelper.lastBrightnessY; int brightness = 0xF0; int brightX = brightness % 65536; int brightY = brightness / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F); for (int i = 0; i < size; i++) { Triplet<Double, Double, Double> origin = randCoords.get(i); Triplet<Double, Double, Double> target = randCoords.get(i + 1); double oX = originX + ((targetX - originX) / size) * (i) + origin.getValue0(); double tX = originX + ((targetX - originX) / size) * (i + 1) + target.getValue0(); double oY = originY + ((targetY - originY) / size) * (i) + origin.getValue1(); double tY = originY + ((targetY - originY) / size) * (i + 1) + target.getValue1(); double oZ = originZ + ((targetZ - originZ) / size) * (i) + origin.getValue2(); double tZ = originZ + ((targetZ - originZ) / size) * (i + 1) + target.getValue2(); drawThunderboldPart(Tessellator.instance, oX, oY, oZ, tX, tY, tZ); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLightX, prevLightY); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); }
From source file:de.sanandrew.mods.claysoldiers.client.render.item.ItemRendererClayNexus.java
License:Creative Commons License
private void renderNexus(float x, float y, float z) { GL11.glPushMatrix();/*from w ww. j a va 2 s . co m*/ GL11.glTranslatef(x, y + 1.57F + 0.125F, z); GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.1875F, 1.1875F, 1.1875F); Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_TEXTURE); this.modelClayNexus.renderTileEntity(); Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_GLOWING); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); this.modelClayNexus.renderTileEntityGlowmap(); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java
License:Creative Commons License
private void renderGlowmap(TileEntityClayNexus nexus) { float[] colors = new float[] { 1.0F, 1.0F, 1.0F }; if (nexus.getStackInSlot(0) != null) { RGBAValues rgba = SAPUtils/* w w w . ja va2 s .c om*/ .getRgbaFromColorInt(ItemClayManDoll.getTeam(nexus.getStackInSlot(0)).getIconColor()); colors[0] = rgba.getRed() / 255.0F; colors[1] = rgba.getGreen() / 255.0F; colors[2] = rgba.getBlue() / 255.0F; } GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glDisable(GL11.GL_ALPHA_TEST); float prevBrightX = OpenGlHelper.lastBrightnessX; float prevBrightY = OpenGlHelper.lastBrightnessY; if (nexus.isActive) { int brightness = 0xF0; int brightX = brightness % 65536; int brightY = brightness / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX, brightY); } this.bindTexture(Textures.NEXUS_GLOWING); GL11.glColor3f(colors[0], colors[1], colors[2]); this.nexusModel.renderTileEntityGlowmap(); GL11.glColor3f(1.0F, 1.0F, 1.0F); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevBrightX, prevBrightY); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); }
From source file:de.sanandrew.mods.turretmod.client.gui.control.GuiIconTab.java
License:Creative Commons License
@Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) { GL11.glEnable(GL11.GL_BLEND);/*from ww w.j av a2 s . c om*/ OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); mc.renderEngine.bindTexture(Textures.GUI_BUTTONS.getResource()); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; int hoverState = this.getHoverState(this.field_146123_n); this.drawTexturedModalRect(this.xPosition, this.yPosition, 26 * (isRight ? 0 : 1), hoverState * 26, this.width, this.height); this.mouseDragged(mc, mouseX, mouseY); // de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.renderItemInGui(mc, this.renderedItem, this.xPosition + 5, this.yPosition + 5); // this.drawItemStack(this.renderedItem, this.xPosition + 5, this.yPosition + 5, var4, par1Minecraft); this.drawIcon(this.renderedIcon, this.xPosition + 5, this.yPosition + 5, mc); if (this.field_146123_n) { this.drawTabHoveringText(this.displayString, this.xPosition - (this.isRight ? mc.fontRenderer.getStringWidth(this.displayString) + 5 : -5), this.yPosition + 21, mc.fontRenderer); } GL11.glDisable(GL11.GL_BLEND); RenderHelper.disableStandardItemLighting(); } }