List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:akarnokd.opengl.experiment.FontExample.java
License:Apache License
/** * Initialise the GL display/* w ww. j av a 2s . c o m*/ * * @param width The width of the display * @param height The height of the display */ private void initGL(int width, int height) { try { Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); Display.setVSyncEnabled(true); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:allout58.mods.techtree.client.GuiEditTree2.java
License:Open Source License
@SuppressWarnings("unchecked") protected void drawOverlay(int mouseX, int mouseY) { for (AbstractGuiButtonNode btn : buttons.values()) { if (btn.mousePressed(this.mc, mouseX, mouseY)) { int w = Math.max(fontRendererObj.getStringWidth(btn.getNode().getName()) + 20, 100); int h = (int) ((fontRendererObj.listFormattedStringToWidth(btn.getNode().getDescription(), w).size() + 1) * fontRendererObj.FONT_HEIGHT * 0.5 + fontRendererObj.FONT_HEIGHT + 35); if (mouseX > width / 2) { mouseX -= w;/*from w w w . j a v a 2 s . co m*/ } try { RenderingHelper.drawRoundedRectangle(mouseX + 2, mouseY + 2, w, h, 7, Config.INSTANCE.client.colorOverlayBackground); fontRendererObj.drawString(btn.getNode().getName(), mouseX + 2 + 6, mouseY + 2 + 6, Config.INSTANCE.client.colorOverlayText, true); drawHorizontalLine(mouseX + 7, mouseX + w - 7, mouseY + 10 + fontRendererObj.FONT_HEIGHT, Config.INSTANCE.client.colorOverlayOther); GL11.glPushMatrix(); GL11.glScaled(0.5, 0.5, 0); GL11.glTranslated(mouseX, mouseY, 0); fontRendererObj.drawString( StatCollector.translateToLocalFormatted("gui.scienceRequired", btn.getNode().getScienceRequired()), mouseX + 14, mouseY + 17 + fontRendererObj.FONT_HEIGHT * 3, Config.INSTANCE.client.colorOverlayText); fontRendererObj.drawSplitString(btn.getNode().getDescription(), mouseX + 14, mouseY + 22 + fontRendererObj.FONT_HEIGHT * 4, w * 2 - 10, Config.INSTANCE.client.colorOverlayText); GL11.glPopMatrix(); for (int i = 0; i < btn.getNode().getLockedItems().length; i++) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); drawRect(mouseX + 14 + 18 * i, mouseY + h - 18, mouseX + 30 + 18 * i, mouseY + h - 2, 0xFFB0B0B0); itemRender.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine, btn.getNode().getLockedItems()[i], mouseX + 14 + 18 * i, mouseY + h - 18); } } catch (IllegalArgumentException e) { e.printStackTrace(); } } } }
From source file:allout58.mods.techtree.client.GuiNodeEdit.java
License:Open Source License
@Override public void drawScreen(int mouseX, int mouseY, float renderPartials) { drawBackground();//from w w w . j a v a2 s. co m for (GuiTextField field : fieldList) field.drawTextBox(); super.drawScreen(mouseX, mouseY, renderPartials); for (int i = 0; i < editItems.size(); i++) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); drawRect(GuiTree.X_START + 34 + 18 * i, GuiTree.Y_START + 120, GuiTree.X_START + 50 + 18 * i, GuiTree.Y_START + 136, 0xFFB0B0B0); itemRender.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine, editItems.get(i), GuiTree.X_START + 34 + 18 * i, GuiTree.Y_START + 120); } }
From source file:allout58.mods.techtree.client.GuiTree.java
License:Open Source License
@SuppressWarnings("unchecked") protected void drawOverlay(int mouseX, int mouseY) { for (AbstractGuiButtonNode btn : buttons.values()) { if (btn.mousePressed(this.mc, mouseX, mouseY)) { int w = Math.max(fontRendererObj.getStringWidth(btn.getNode().getName()) + 20, 100); int h = (int) ((fontRendererObj.listFormattedStringToWidth(btn.getNode().getDescription(), w).size() + 1) * fontRendererObj.FONT_HEIGHT * 0.5 + fontRendererObj.FONT_HEIGHT + 35); if (mouseX < width / 2) { mouseX -= w;// ww w . j a v a 2 s. com } try { RenderingHelper.drawRoundedRectangle(mouseX + 2, mouseY + 2, w, h, 7, Config.INSTANCE.client.colorOverlayBackground); fontRendererObj.drawString(btn.getNode().getName(), mouseX + 2 + 6, mouseY + 2 + 6, Config.INSTANCE.client.colorOverlayText, true); drawHorizontalLine(mouseX + 7, mouseX + w - 7, mouseY + 10 + fontRendererObj.FONT_HEIGHT, Config.INSTANCE.client.colorOverlayOther); GL11.glPushMatrix(); GL11.glScaled(0.5, 0.5, 0); GL11.glTranslated(mouseX, mouseY, 0); fontRendererObj.drawString( StatCollector.translateToLocalFormatted("gui.scienceRequired", btn.getNode().getScienceRequired()), mouseX + 14, mouseY + 17 + fontRendererObj.FONT_HEIGHT * 3, Config.INSTANCE.client.colorOverlayText); fontRendererObj.drawSplitString(btn.getNode().getDescription(), mouseX + 14, mouseY + 22 + fontRendererObj.FONT_HEIGHT * 4, w * 2 - 10, Config.INSTANCE.client.colorOverlayText); GL11.glPopMatrix(); for (int i = 0; i < btn.getNode().getLockedItems().length; i++) { GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_LIGHTING); drawRect(mouseX + 14 + 18 * i, mouseY + h - 18, mouseX + 30 + 18 * i, mouseY + h - 2, 0xFFB0B0B0); itemRender.renderItemIntoGUI(fontRendererObj, Minecraft.getMinecraft().renderEngine, btn.getNode().getLockedItems()[i], mouseX + 14 + 18 * i, mouseY + h - 18); } } catch (IllegalArgumentException e) { e.printStackTrace(); } } } }
From source file:allout58.mods.techtree.util.RenderingHelper.java
License:Open Source License
public static void draw2DLine(int x1, int y1, int x2, int y2, float width, int colorRGB) { float red = (float) (colorRGB >> 16 & 255) / 255.0F; float blue = (float) (colorRGB >> 8 & 255) / 255.0F; float green = (float) (colorRGB & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from www .j a v a 2 s . co m*/ GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(width); GL11.glPushMatrix(); GL11.glColor3f(red, green, blue); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(x1, y1, 0.0D); GL11.glVertex3d(x2, y2, 0.0D); GL11.glEnd(); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
From source file:allout58.mods.techtree.util.RenderingHelper.java
License:Open Source License
public static void drawRoundedRectangle(int x, int y, int width, int height, int radius, int color, int borderColor) throws IllegalArgumentException { if (radius * 2 > Math.abs(width)) throw new IllegalArgumentException("Error! Width not large enough for radius!"); if (radius * 2 > Math.abs(height)) throw new IllegalArgumentException("Error! Height not large enough for radius!"); if (width < 0) { x += width;/*w w w . j ava2s . c om*/ width = Math.abs(width); } if (height < 0) { y += height; height = Math.abs(height); } int x1Inner = x + radius; int y1Inner = y + radius; int x2Inner = x + width - radius; int y2Inner = y + height - radius; float red = (float) (borderColor >> 16 & 255) / 255.0F; float green = (float) (borderColor >> 8 & 255) / 255.0F; float blue = (float) (borderColor & 255) / 255.0F; float alpha = (float) (borderColor >> 24 & 255) / 255.0F; Gui.drawRect(x, y1Inner, x1Inner, y2Inner, borderColor); Gui.drawRect(x1Inner, y, x2Inner, y1Inner, borderColor); Gui.drawRect(x2Inner, y1Inner, x + width, y2Inner, borderColor); Gui.drawRect(x1Inner, y2Inner, x2Inner, y + height, borderColor); Gui.drawRect(x1Inner, y1Inner, x2Inner, y2Inner, color); ArrayList<Point> curves = new ArrayList<Point>(); final double[][] start = new double[][] { { x1Inner, y1Inner }, { x2Inner, y1Inner }, { x2Inner, y2Inner }, { x1Inner, y2Inner } }; for (int corner = 0; corner < 4; corner++) { curves.clear(); for (int i = 0; i < VERTEX_PER_CURVE + 1; i++) { double theta = deltaTheta * i + dT[corner]; Point p = new Point(Math.cos(theta), Math.sin(theta)); curves.add(p); } GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glPushMatrix(); GL11.glColor4f(red, green, blue, alpha); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex3d(start[corner][0], start[corner][1], 0); for (int i = curves.size() - 1; i >= 0; i--) { GL11.glVertex3d((curves.get(i).getX()) * radius + start[corner][0], (curves.get(i).getY()) * radius + start[corner][1], 0); } GL11.glEnd(); GL11.glPopMatrix(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:aphelion.client.Client.java
License:Open Source License
private static void glDisableAll() { GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_COLOR_LOGIC_OP); GL11.glDisable(GL11.GL_CULL_FACE);//from www .jav a 2s. co m GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_DITHER); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL); GL11.glDisable(GL11.GL_POLYGON_OFFSET_LINE); GL11.glDisable(GL11.GL_POLYGON_OFFSET_POINT); GL11.glDisable(GL11.GL_POLYGON_SMOOTH); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glDisable(GL11.GL_STENCIL_TEST); }
From source file:appeng.client.gui.widgets.GuiTabButton.java
License:Open Source License
@Override public void drawButton(final Minecraft minecraft, final int x, final int y) { if (this.visible) { GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); minecraft.renderEngine.bindTexture(ExtraBlockTextures.GuiTexture("guis/states.png")); this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height; int uv_x = (this.hideEdge > 0 ? 11 : 13); final int offsetX = this.hideEdge > 0 ? 1 : 0; this.drawTexturedModalRect(this.xPosition, this.yPosition, uv_x * 16, 0, 25, 22); if (this.myIcon >= 0) { final int uv_y = (int) Math.floor(this.myIcon / 16); uv_x = this.myIcon - uv_y * 16; this.drawTexturedModalRect(offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16);/*w ww . jav a 2 s . c o m*/ } this.mouseDragged(minecraft, x, y); if (this.myItem != null) { this.zLevel = 100.0F; this.itemRenderer.zLevel = 100.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); final FontRenderer fontrenderer = minecraft.fontRenderer; this.itemRenderer.renderItemAndEffectIntoGUI(fontrenderer, minecraft.renderEngine, this.myItem, offsetX + this.xPosition + 3, this.yPosition + 3); GL11.glDisable(GL11.GL_LIGHTING); this.itemRenderer.zLevel = 0.0F; this.zLevel = 0.0F; } } }
From source file:appeng.client.render.AppEngRenderItem.java
License:Open Source License
@Override public void renderItemOverlayIntoGUI(final FontRenderer fontRenderer, final TextureManager textureManager, final ItemStack is, final int par4, final int par5, final String par6Str) { if (is != null) { final float scaleFactor = AEConfig.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f; final float inverseScaleFactor = 1.0f / scaleFactor; final int offset = AEConfig.instance.useTerminalUseLargeFont() ? 0 : -1; final boolean unicodeFlag = fontRenderer.getUnicodeFlag(); fontRenderer.setUnicodeFlag(false); if (is.getItem().showDurabilityBar(is)) { final double health = is.getItem().getDurabilityForDisplay(is); final int j1 = (int) Math.round(13.0D - health * 13.0D); final int k = (int) Math.round(255.0D - health * 255.0D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); final Tessellator tessellator = Tessellator.instance; final int l = 255 - k << 16 | k << 8; final int i1 = (255 - k) / 4 << 16 | 16128; this.renderQuad(tessellator, par4 + 2, par5 + 13, 13, 2, 0); this.renderQuad(tessellator, par4 + 2, par5 + 13, 12, 1, i1); this.renderQuad(tessellator, par4 + 2, par5 + 13, j1, 1, l); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }//from w w w .jav a 2s .com if (is.stackSize == 0) { final String craftLabelText = AEConfig.instance.useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft.getLocal(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); final int X = (int) (((float) par4 + offset + 16.0f - fontRenderer.getStringWidth(craftLabelText) * scaleFactor) * inverseScaleFactor); final int Y = (int) (((float) par5 + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor); fontRenderer.drawStringWithShadow(craftLabelText, X, Y, 16777215); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } final long amount = this.aeStack != null ? this.aeStack.getStackSize() : is.stackSize; if (amount != 0) { final String stackSize = this.getToBeRenderedStackSize(amount); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glScaled(scaleFactor, scaleFactor, scaleFactor); final int X = (int) (((float) par4 + offset + 16.0f - fontRenderer.getStringWidth(stackSize) * scaleFactor) * inverseScaleFactor); final int Y = (int) (((float) par5 + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor); fontRenderer.drawStringWithShadow(stackSize, X, Y, 16777215); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); } fontRenderer.setUnicodeFlag(unicodeFlag); } }
From source file:appeng.client.render.blocks.RenderBlockCharger.java
License:Open Source License
@Override public void renderTile(final BlockCharger block, final TileCharger tile, final Tessellator tess, final double x, final double y, final double z, final float f, final RenderBlocks renderer) { final ItemStack sis = tile.getStackInSlot(0); if (sis != null) { GL11.glPushMatrix();/*from w ww .j a v a2 s . c o m*/ this.applyTESRRotation(x, y, z, tile.getForward(), tile.getUp()); try { GL11.glTranslatef(0.5f, 0.45f, 0.5f); GL11.glScalef(1.0f / 1.1f, 1.0f / 1.1f, 1.0f / 1.1f); GL11.glScalef(1.0f, 1.0f, 1.0f); final Block blk = Block.getBlockFromItem(sis.getItem()); if (sis.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(blk.getRenderType())) { GL11.glRotatef(25.0f, 1.0f, 0.0f, 0.0f); GL11.glRotatef(15.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(30.0f, 0.0f, 1.0f, 0.0f); } // << 20 | light << 4; final int br = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, tile.zCoord, 0); final int var11 = br % 65536; final int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11, var12); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL12.GL_RESCALE_NORMAL); tess.setColorOpaque_F(1.0f, 1.0f, 1.0f); this.doRenderItem(sis, tile); } catch (final Exception err) { AELog.error(err); } GL11.glPopMatrix(); } }