List of usage examples for org.lwjgl.opengl GL11 glDepthMask
public static void glDepthMask(@NativeType("GLboolean") boolean flag)
From source file:org.getspout.spout.gui.server.GuiServerInfo.java
License:Open Source License
@Override public void drawScreen(int var1, int var2, float var3) { this.drawDefaultBackground(); if (flag != null) { GL11.glPushMatrix();//from www.ja va 2 s . c om GL11.glTranslatef(this.width / 2 + 150, this.height / 2 - 84, 0); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBindTexture(GL11.GL_TEXTURE_2D, flag.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, 6, -90, 0.0D, 0.0D); // draw corners tessellator.addVertexWithUV(9, 6, -90, flag.getWidth(), 0.0D); tessellator.addVertexWithUV(9, 0.0D, -90, flag.getWidth(), flag.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, flag.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } else { flag = CustomTextureManager.getTextureFromUrl( "http://servers.getspout.org/images/flags/" + info.country.toLowerCase() + ".png"); } if (image != null) { GL11.glPushMatrix(); GL11.glTranslatef(this.width / 2 - 110 - (image.getImageWidth() / 4), this.height / 2 - 20 - (image.getImageHeight() / 4), 0); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glBindTexture(GL11.GL_TEXTURE_2D, image.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, image.getImageHeight() / 2, -90, 0.0D, 0.0D); // draw corners tessellator.addVertexWithUV(image.getImageWidth() / 2, image.getImageHeight() / 2, -90, image.getWidth(), 0.0D); tessellator.addVertexWithUV(image.getImageWidth() / 2, 0.0D, -90, image.getWidth(), image.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, image.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } else { image = CustomTextureManager.getTextureFromUrl(url); } this.drawString(SpoutClient.getHandle().fontRenderer, "Server IP:Port", this.width / 2 - 20, this.height / 2 - 95, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.getFullIp(), this.width / 2 - 10, this.height / 2 - 85, 0xA0A0A0); this.drawString(SpoutClient.getHandle().fontRenderer, "Name", this.width / 2 - 20, this.height / 2 - 70, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.name, this.width / 2 - 10, this.height / 2 - 60, 0xA0A0A0); this.drawString(SpoutClient.getHandle().fontRenderer, "Country", this.width / 2 + 120, this.height / 2 - 95, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.country, this.width / 2 + 130, this.height / 2 - 85, 0xA0A0A0); this.drawString(SpoutClient.getHandle().fontRenderer, "Players", this.width / 2 + 120, this.height / 2 - 70, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.players + "/" + info.maxPlayers, this.width / 2 + 130, this.height / 2 - 60, 0xA0A0A0); this.drawString(SpoutClient.getHandle().fontRenderer, "Response", this.width / 2 - 20, this.height / 2 - 45, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.msg + ChatColor.GRAY + " (" + info.ping + "ms)", this.width / 2 - 10, this.height / 2 - 35, 0xA0A0A0); this.drawString(SpoutClient.getHandle().fontRenderer, "Website", this.width / 2 - 20, this.height / 2 - 20, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, site, this.width / 2 - 10, this.height / 2 - 10, hoveringSite ? 0x0099FF : 0x40FFFF); this.drawString(SpoutClient.getHandle().fontRenderer, "Forum Post", this.width / 2 - 20, this.height / 2 + 5, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, forum, this.width / 2 - 10, this.height / 2 + 15, hoveringForum ? 0x0099FF : 0x40FFFF); this.drawString(SpoutClient.getHandle().fontRenderer, "Description", this.width / 2 - 20, this.height / 2 + 30, 0xFFFFFF); this.drawString(SpoutClient.getHandle().fontRenderer, info.description, this.width / 2 - 10, this.height / 2 + 40, 0xA0A0A0); super.drawScreen(var1, var2, var3); }
From source file:org.mudraker.blockplacer.Event.java
License:Open Source License
/** * Draws the selection box for the player. * <p>Args: entityPlayer, rayTraceHit, i, partialTickTime * <p>Based on net.minecraft.client.renderer.RenderGlobal.java. * Which is called by net.minecraft.client.renderer.entityRenderer.java. * @@MCVERSION164@@//from w w w.j av a 2 s . co m */ private void drawSelectionBox(EntityPlayer par1EntityPlayer, MovingObjectPosition par2MovingObjectPosition, int par3, float par4) { // Add config instance declaration Config config = Config.getInstance(); if (par3 == 0 && par2MovingObjectPosition.typeOfHit == EnumMovingObjectType.TILE) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // Replaced to configure colour and width // GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); // GL11.glLineWidth(2.0F); if (config.frameSwapInNether && par1EntityPlayer.dimension == DIMENSION_NETHER) { GL11.glColor4f(config.frameGreenF, config.frameRedF, config.frameBlueF, config.frameAlphaF); } else { GL11.glColor4f(config.frameRedF, config.frameGreenF, config.frameBlueF, config.frameAlphaF); } GL11.glLineWidth((float) config.frameLineWidth); // end change GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(false); // Replaced to configure expansion //float f1 = 0.002F; float f1 = config.frameExpand; // end change int j = this.theWorld.getBlockId(par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ); if (j > 0) { // Removed - Don't need to get block specific bounds // Block.blocksList[j].setBlockBoundsBasedOnState(this.theWorld, par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ); double d0 = par1EntityPlayer.lastTickPosX + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4; double d1 = par1EntityPlayer.lastTickPosY + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4; double d2 = par1EntityPlayer.lastTickPosZ + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4; // Replaced - Don't need to get block specific box // But do need to use the BlockPlacer position instead. //this.drawOutlinedBoundingBox(Block.blocksList[j].getSelectedBoundingBoxFromPool(this.theWorld, par2MovingObjectPosition.blockX, par2MovingObjectPosition.blockY, par2MovingObjectPosition.blockZ).expand((double)f1, (double)f1, (double)f1).getOffsetBoundingBox(-d0, -d1, -d2)); this.drawOutlinedBoundingBox( this.getFullBoundingBoxFromPool(drawPosition.x, drawPosition.y, drawPosition.z) .expand((double) f1, (double) f1, (double) f1).getOffsetBoundingBox(-d0, -d1, -d2)); // end change } GL11.glDepthMask(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); } }
From source file:org.oscim.gdx.LwjglGL20.java
License:Apache License
public void depthMask(boolean flag) { GL11.glDepthMask(flag); }
From source file:org.spoutcraft.api.gui.renderer.GuiRendererFBO.java
License:MIT License
@Override public void setClip(int x, int y, int width, int height) { super.setClip(x, y, width, height); GL11.glColorMask(false, false, false, false); GL11.glDepthMask(false); GL11.glStencilFunc(GL11.GL_NEVER, 1, 0xFF); GL11.glStencilOp(GL11.GL_REPLACE, GL11.GL_KEEP, GL11.GL_KEEP); GL11.glStencilMask(0xFF);//from ww w . j a va 2s. c om clearClip(); //Actually fill stencil area RenderUtil.drawRect(x, y, width, height, Color.WHITE); GL11.glColorMask(true, true, true, true); GL11.glDepthMask(true); GL11.glStencilMask(0x00); GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); }
From source file:org.spoutcraft.client.gui.about.GuiAbout.java
License:Open Source License
@Override public void drawScreen(int x, int y, float z) { super.drawBackground(0); GL11.glPushMatrix();/*ww w . j av a 2 s .c o m*/ GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDisable(2912 /*GL_FOG*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); bg.setTopColor(background1); 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(); // Right half int top = 0; drawScaledString("What is Spoutcraft?", this.width / 2 - 200, top, 0xffffff); top += 10; drawScaledString("Spoutcraft is a modification for the", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Minecraft client that plays exactly", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("like the official game. Its goal is", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("to give developers an easy to use", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("platform for building and distributing", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("mods, while providing a rich", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("gameplay experience for users.", this.width / 2 - 200, top, 0x808080); top += 10; top += 20; drawScaledString("What is Spout?", this.width / 2 - 200, top, 0xffffff); top += 10; drawScaledString("Spout is a Bukkit plugin development", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("platform that allows for previously", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("impossible tasks, such as custom items", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("blocks, mobs, animals, and vehicles. ", this.width / 2 - 200, top, 0x808080); top += 10; top += 20; drawScaledString("Who is SpoutDev?", this.width / 2 - 200, top, 0xffffff); top += 10; drawScaledString("SpoutDev is the team behind Spout, ", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("SpoutAPI, Spoutcraft,", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("and Spoutcraft Launcher.", this.width / 2 - 200, top, 0x808080); top += 10; top += 20; drawScaledString("Contributors", this.width / 2 - 200, top, 0xffffff); top += 10; drawScaledString("The Bukkit Team - Bukkit Server API", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("lahwran - Fast Events Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("lahwran - Minimap Logic", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Celtic Minstrel - Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Zeerix - Threading Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Karlthepagan - OptiTick Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Kahr - HD Textures Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Jeckari - Custom Texture Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Rycochet - GUI Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("knowbuddy - GUI Optimizations", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("TomyLobo - Mipmapping Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("Apache Foundation - Code", this.width / 2 - 200, top, 0x808080); top += 10; drawScaledString("ThVortex - FontRenderer fixes", this.width / 2 - 200, top, 0x808080); top += 10; // Left half top = 0; drawScaledString("Sponsors", this.width / 2 + 30, top, 0xffffff); top += 10; top = 130; drawScaledString("Team", this.width / 2 + 30, top, 0xffffff); top += 10; drawScaledString("Afforess - Lead Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Wulfspider - Co-Lead & Support", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("alta189 - Co-Lead & Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Top_Cat - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("raphfrk - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("narrowtux - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Olloth - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Rycochet - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("RoyAwesome - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("zml2008 - Developer", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Zidane - Developer", this.width / 2 + 30, top, 0x808080); top += 10; top += 20; drawScaledString("Contact", this.width / 2 + 30, top, 0xffffff); top += 10; drawScaledString("Email: dev@spout.org", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("Website: spout.org", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("#spout on irc.esper.net", this.width / 2 + 30, top, 0x808080); top += 10; top += 20; drawScaledString("Note", this.width / 2 + 30, top, 0xffffff); top += 10; drawScaledString("Spoutcraft, Spout, and related", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("projects are open source. You", this.width / 2 + 30, top, 0x808080); top += 10; drawScaledString("can browse the source code at", this.width / 2 + 30, top, 0x808080); top += 10; sourceY = top; sourceWidth = this.fontRenderer.getStringWidth("https://github.com/SpoutDev"); drawScaledString("https://github.com/SpoutDev", this.width / 2 + 30, sourceY, hoveringLink ? 0x65A5D1 : 0x176093); top += 10; top += 20; int beastNodeX = (this.width / 2 + 30); int beastNodeY = getScaledHeight(15); if (beastNodeLogo != null) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef(beastNodeX, beastNodeY, 0); // Moves texture into place SpoutClient.getHandle().renderEngine.bindTexture(beastNodeLogo.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; //GL11.glScalef(0.5f, 0.5f, 0.5f); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners tessellator.addVertexWithUV(147, 33, -90, beastNodeLogo.getWidth(), 0.0D); tessellator.addVertexWithUV(147, 0.0D, -90, beastNodeLogo.getWidth(), beastNodeLogo.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, beastNodeLogo.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } int minecraftBizX = (this.width / 2 + 30); int minecraftBizY = getScaledHeight(85); if (minecraftBizLogo != null) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef(minecraftBizX, minecraftBizY, 0); // Moves texture into place SpoutClient.getHandle().renderEngine.bindTexture(minecraftBizLogo.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; //GL11.glScalef(0.5f, 0.5f, 0.5f); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, 33, -90, 0.0D, 0.0D); // Draw corners tessellator.addVertexWithUV(147, 33, -90, minecraftBizLogo.getWidth(), 0.0D); tessellator.addVertexWithUV(147, 0.0D, -90, minecraftBizLogo.getWidth(), minecraftBizLogo.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, minecraftBizLogo.getHeight()); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } // Draw tooltips if (isInBoundingRect(beastNodeX, beastNodeY, 33, 147, x, y)) { drawTooltip("BeastNode provides high quality Minecraft and web hosting at affordable\n" + "prices and is generously sponsoring the Spout project with its hosting\n" + "& server needs. Mine, build, craft, and chat with your own high quality\n" + "Minecraft server with FREE mumble voice server and web hosting.", x, y); } else if (isInBoundingRect(minecraftBizX, minecraftBizY, 33, 147, x, y)) { drawTooltip("Your Minecraft community in a new dimension!", x, y); } GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); SpoutClient.getHandle().renderEngine.bindTexture("/gui/gui.png"); RenderUtil.drawTexturedModalRectangle(this.width - 14, getInvertedScaledHeight(this.height), 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); SpoutClient.getHandle().renderEngine.bindTexture("/title/mclogo.png"); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPushMatrix(); GL11.glTranslatef((0.0325f * this.width), (this.height - 40), 0); GL11.glScalef(0.4f, 0.4f, 0.4f); this.drawTexturedModalRect(0, 0, 0, 0, 155, 44); this.drawTexturedModalRect(155, 0, 0, 45, 155, 44); GL11.glPopMatrix(); if (spoutcraftTexture != null) { GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((this.width - 140), (this.height - 45), 0); // Moves texture into place SpoutClient.getHandle().renderEngine.bindTexture(spoutcraftTexture.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, spoutcraftTexture.getWidth(), 0.0D); tessellator.addVertexWithUV(128, 0.0D, -90, spoutcraftTexture.getWidth(), spoutcraftTexture.getHeight()); tessellator.addVertexWithUV(0.0D, 0.0D, -90, 0.0D, spoutcraftTexture.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, "Unknown Version", (int) (this.width * 0.034f), this.height - 20, 0xffffff); drawString(this.fontRenderer, "Copyright Mojang AB", (int) (this.width * 0.034f), this.height - 10, 0x808080); String version = SpoutClient.getClientVersion(); drawString(this.fontRenderer, version, (int) (this.width - 45) - fontRenderer.getStringWidth(version) + fontRenderer.getStringWidth("0"), this.height - 20, 0xffffff); drawString(this.fontRenderer, "Licensed under LGPLv3", (int) (this.width - 129), this.height - 10, 0x808080); ((GuiButton) this.buttonList.get(0)).xPosition = this.width / 2 - 50; ((GuiButton) this.buttonList.get(0)).yPosition = this.height - 25; ((GuiButton) this.buttonList.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(); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glPopMatrix(); }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void render(GenericBitmap bitmap) { int textureId; if (bitmapId.containsKey(bitmap)) { textureId = bitmapId.get(bitmap); } else {/* w w w. j a v a 2s . c om*/ IntBuffer tmp = IntBuffer.allocate(1); GL11.glGenTextures(tmp); textureId = tmp.get(0); bitmapId.put(bitmap, textureId); } int width = (int) bitmap.getActualWidth(); int height = (int) bitmap.getActualHeight(); int left = bitmap.getLeft(); int top = bitmap.getTop(); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, bitmap.getRawWidth(), bitmap.getRawHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, bitmap.getBuffer()); GL11.glTranslatef((float) bitmap.getScreenX(), (float) bitmap.getScreenY(), 0); // moves texture into place GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); GL11.glDepthMask(false); bindColor(new Color(1.0F, 1.0F, 1.0F)); SpoutClient.getHandle().renderEngine.bindTexture(textureId); 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); double tLeft = 0, tTop = 0, rWidth = bitmap.getWidth(), rHeight = bitmap.getHeight(), tWidth = rWidth, tHeight = rHeight; if (top >= 0 && left >= 0) { tWidth = Math.min(tWidth, width); tHeight = Math.min(tHeight, height); tLeft = Math.min(Math.max(0, left), rWidth); tTop = Math.min(Math.max(0, top), rHeight); } Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, -90, tLeft, tTop); // draw corners tessellator.addVertexWithUV(width, height, -90, tWidth, tTop); tessellator.addVertexWithUV(width, 0.0D, -90, tWidth, tHeight); tessellator.addVertexWithUV(0.0D, 0.0D, -90, tLeft, tHeight); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); }
From source file:org.spoutcraft.client.gui.MCRenderDelegate.java
License:Open Source License
public void drawTexture(Texture textureBinding, int width, int height, Color color, boolean blend, int left, int top, boolean mipmap, int filter) { if (textureBinding == null) { return;/*from w w w .j av a 2s .c o m*/ } GL11.glPushMatrix(); GL11.glDisable(GL11.GL_DEPTH_TEST); boolean wasBlend = GL11.glGetBoolean(GL11.GL_BLEND); if (blend) { GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 771); } GL11.glDepthMask(false); bindColor(color); SpoutClient.getHandle().renderEngine.bindTexture(textureBinding.getTextureID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter); if (mipmap) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, 8); ContextCapabilities capabilities = GLContext.getCapabilities(); if (capabilities.OpenGL30) { GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); } else if (capabilities.GL_EXT_framebuffer_object) { EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_2D); } else if (capabilities.OpenGL14) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE); } } double tLeft = 0, tTop = 0, rWidth = textureBinding.getWidth(), rHeight = textureBinding.getHeight(), tWidth = rWidth, tHeight = rHeight; if (top >= 0 && left >= 0) { tWidth = Math.min(tWidth, (width / (double) textureBinding.getImageWidth()) * textureBinding.getWidth()); tHeight = Math.min(tHeight, (height / (double) textureBinding.getImageHeight()) * textureBinding.getHeight()); tLeft = Math.min( Math.max(0, (left / (double) textureBinding.getImageWidth())) * textureBinding.getWidth(), rWidth); tTop = Math.min( Math.max(0, (top / (double) textureBinding.getImageHeight()) * textureBinding.getHeight()), rHeight); } tHeight = -tHeight; tTop = rHeight - tTop; Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0.0D, height, -90, tLeft, tTop + tHeight); // draw corners tessellator.addVertexWithUV(width, height, -90, tLeft + tWidth, tTop + tHeight); tessellator.addVertexWithUV(width, 0.0D, -90, tLeft + tWidth, tTop); tessellator.addVertexWithUV(0.0D, 0.0D, -90, tLeft, tTop); tessellator.draw(); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); if (blend && !wasBlend) { GL11.glDisable(GL11.GL_BLEND); } }
From source file:org.spoutcraft.client.gui.minimap.MapRenderer.java
License:Open Source License
/** * Do rendering/*from w w w .ja v a 2 s.c om*/ * * @param scWidth * screen width * @param scHeight * screen height */ public void onRenderTick(int scWidth, int scHeight) { if (this.oldDir != Minecraft.theMinecraft.thePlayer.rotationYaw) { this.direction += this.oldDir - Minecraft.theMinecraft.thePlayer.rotationYaw; this.oldDir = Minecraft.theMinecraft.thePlayer.rotationYaw; } if (this.direction >= 360.0f) this.direction %= 360.0f; if (this.direction < 0.0f) { while (this.direction < 0.0f) this.direction += 360.0f; } GL11.glPushMatrix(); GL11.glTranslatef(scWidth, 0.0f, 0.0f); GL11.glTranslatef(MinimapConfig.getInstance().getAdjustX(), MinimapConfig.getInstance().getAdjustY(), 0); GL11.glScalef(MinimapConfig.getInstance().getSizeAdjust(), MinimapConfig.getInstance().getSizeAdjust(), 1F); if (!MinimapConfig.getInstance().isScale()) { float scaleFactor = Math.max(scWidth / 427, scHeight / 240F); GL11.glScalef(scaleFactor, scaleFactor, 1); } renderMap(); if (MinimapConfig.getInstance().isCavemap()) renderMapFull(0, scHeight); GL11.glDepthMask(true); GL11.glDisable(3042); GL11.glEnable(2929); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); showCoords(0); GL11.glPopMatrix(); }
From source file:org.spoutcraft.client.gui.minimap.MapRenderer.java
License:Open Source License
private void renderMap() { GL11.glDisable(2929);/*from w w w. j a va 2s.c o m*/ GL11.glEnable(3042); GL11.glDepthMask(false); GL11.glBlendFunc(770, 0); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if (MinimapConfig.getInstance().isEnabled()) { if (MinimapConfig.getInstance().isSquare()) { // Scale GL11.glPushMatrix(); switch (MinimapConfig.getInstance().getZoom()) { case 0: GL11.glScalef(8F, 8F, 1F); GL11.glTranslatef(56, 0, 0F); break; case 1: GL11.glScalef(4F, 4F, 1F); GL11.glTranslatef(48, 0, 0F); break; case 2: GL11.glScalef(2F, 2F, 1F); GL11.glTranslatef(32, 0, 0F); break; } map.loadColorImage(); drawOnMap(); if (MinimapConfig.getInstance().isHeightmap()) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR); map.loadHeightImage(); drawOnMap(); } GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); renderEntities(); try { GL11.glPushMatrix(); GL11.glScalef(1.8f, 1.8f, 1.0f); GL11.glTranslatef(27, -1, 0F); // don't ask if (MinimapConfig.getInstance().isShowBackground()) { texman.loadMinimap(); } else { GL11.glScalef(138F / 256F, 138F / 256F, 1F); GL11.glTranslatef(-54, 0, 0); texman.loadWhiteMinimap(); } drawOnMap(); } catch (Exception e) { // System.err.println("error: minimap overlay not found!"); // e.printStackTrace(); } finally { GL11.glPopMatrix(); } renderWaypoints(); try { GL11.glPushMatrix(); texman.loadMMArrow(); GL11.glTranslatef(-34.0F, 30.0F, 0.0F); GL11.glRotatef(-this.direction + 90F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(32.0F, -(32.0F), 0.0F); drawOnMap(); } catch (Exception e) { // System.err.println("Error: minimap arrow not found!"); e.printStackTrace(); } finally { GL11.glPopMatrix(); } GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // render directions with fudge factor to make them line up GL11.glPushMatrix(); GL11.glTranslatef(-2, 2, 0.0F); drawDirections(); drawFocusSquare(); GL11.glPopMatrix(); } else { GL11.glPushMatrix(); map.loadColorImage(); GL11.glTranslatef(-32.0f, 32.0F, 0.0F); GL11.glRotatef(this.direction + 90.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(32.0F, -(32.0F), 0.0F); switch (MinimapConfig.getInstance().getZoom()) { case 0: GL11.glScalef(8F, 8F, 1F); GL11.glTranslatef(56.25F, 0.25F, 0F); break; case 1: GL11.glScalef(4F, 4F, 1F); GL11.glTranslatef(48.5F, 0.5F, 0F); break; case 2: GL11.glScalef(2F, 2F, 1F); GL11.glTranslatef(33F, 1F, 0F); break; case 3: GL11.glTranslatef(2F, 2F, 0F); break; } drawOnMap(); if (MinimapConfig.getInstance().isHeightmap()) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR); map.loadHeightImage(); drawOnMap(); } GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); renderWaypoints(); renderEntities(); drawRound(); drawDirections(); GL11.glPushMatrix(); drawFocusRound(); GL11.glPopMatrix(); } } }
From source file:org.spoutcraft.client.gui.minimap.MapWidget.java
License:Open Source License
@Override public void renderContents() { GL11.glDisable(2929);/* www .j a va 2 s . co m*/ GL11.glEnable(3042); GL11.glDepthMask(false); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int scrollX = (int) (getScrollPosition(Orientation.HORIZONTAL) / scale); int scrollY = (int) (getScrollPosition(Orientation.VERTICAL) / scale); GL11.glScaled(scale, scale, scale); GL11.glTranslatef(-heightMap.getMinX() * 16, -heightMap.getMinZ() * 16, 0); int minChunkX = heightMap.getMinX() + scrollX / 16, minChunkZ = heightMap.getMinZ() + scrollY / 16, maxChunkX = 0, maxChunkZ = 0; int horiz = (int) (getWidth() / 16 / scale) + 1; int vert = (int) (getHeight() / 16 / scale) + 1; maxChunkX = minChunkX + horiz; maxChunkZ = minChunkZ + vert; minChunkX = Math.max(minChunkX, heightMap.getMinX()); minChunkZ = Math.max(minChunkZ, heightMap.getMinZ()); maxChunkX = Math.min(maxChunkX, heightMap.getMaxX()); maxChunkZ = Math.min(maxChunkZ, heightMap.getMaxZ()); GL11.glPushMatrix(); synchronized (chunks) { for (int chunkX = minChunkX; chunkX <= maxChunkX; chunkX += levelOfDetail) { for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; chunkZ += levelOfDetail) { Map map = getChunkMap(levelOfDetail).get(chunkX, chunkZ); if (dirty || map == null || random.nextInt(10000) == 0) { renderer.renderQueue.add(new Point(chunkX, chunkZ)); } if (map != null && map != blankMap) { GL11.glPushMatrix(); int x = chunkX * 16; int y = chunkZ * 16; int width = x + 16 * levelOfDetail; int height = y + 16 * levelOfDetail; map.loadColorImage(); MinecraftTessellator tessellator = Spoutcraft.getTessellator(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1); tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0); tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0); tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1); tessellator.draw(); // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // RenderUtil.drawRectangle(x, y, width, height, 0x88ffffff); if (MinimapConfig.getInstance().isHeightmap()) { GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_COLOR); map.loadHeightImage(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double) width, (double) height, -90, 1, 1); tessellator.addVertexWithUV((double) width, (double) y, -90, 1, 0); tessellator.addVertexWithUV((double) x, (double) y, -90, 0, 0); tessellator.addVertexWithUV((double) x, (double) height, -90, 0, 1); tessellator.draw(); } GL11.glPopMatrix(); } } } } int x = (int) SpoutClient.getHandle().thePlayer.posX; int z = (int) SpoutClient.getHandle().thePlayer.posZ; drawPOI("You", x, z, 0xffff0000); for (Waypoint waypoint : MinimapConfig.getInstance().getAllWaypoints(MinimapUtils.getWorldName())) { if (!waypoint.deathpoint || MinimapConfig.getInstance().isDeathpoints()) { drawPOI(waypoint.name, waypoint.x, waypoint.z, 0xff00ff00); } } if (MinimapConfig.getInstance().getFocussedWaypoint() != null) { Waypoint pos = MinimapConfig.getInstance().getFocussedWaypoint(); drawPOI("Marker", pos.x, pos.z, 0xff00ffff); } GL11.glPopMatrix(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(2929); GL11.glDisable(3042); dirty = false; Point newpos = getPlayerPosition(); if (lastPlayerPos.getX() != newpos.getX() || lastPlayerPos.getY() != newpos.getY()) { showPlayer(0); lastPlayerPos = newpos; } }