List of usage examples for org.lwjgl.opengl GL11 glDisable
public static void glDisable(@NativeType("GLenum") int target)
From source file:com.sr2610.steampunkd.handbook.pages.PageRecipe.java
License:Creative Commons License
@Override @SideOnly(Side.CLIENT)//from w w w . java 2 s. co m public void renderScreen(IGuiHandbookEntry gui, int mx, int my) { relativeMouseX = mx; relativeMouseY = my; renderRecipe(gui, mx, my); final int width = gui.getWidth() - 30; final int height = gui.getHeight(); final int x = gui.getLeft() + 16; final int y = (gui.getTop() + height) - 80; PageText.renderText(x, y + 10, width, height, getUnlocalizedName()); if (tooltipStack != null) { final List<String> tooltipData = tooltipStack.getTooltip(Minecraft.getMinecraft().thePlayer, false); TooltipHelper.renderTooltip(mx, my, tooltipData); if (tooltipEntry) tooltipData.add(I18n.format("steampunkd.handbook.clickToRecipe")); if (tooltipContainerStack != null) tooltipData.add(I18n.format("steampunkd.handbook.craftingContainer")); TooltipHelper.renderTooltip(mx, my, tooltipData); } tooltipStack = tooltipContainerStack = null; tooltipEntry = false; GL11.glDisable(GL11.GL_BLEND); }
From source file:com.sr2610.steampunkd.handbook.pages.PageRecipe.java
License:Creative Commons License
@SideOnly(Side.CLIENT) public void renderItem(IGuiHandbookEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) { yPos += 10;/*from ww w .j a va2s .c o m*/ final RenderItem render = Minecraft.getMinecraft().getRenderItem(); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glEnable(GL11.GL_DEPTH_TEST); render.renderItemAndEffectIntoGUI(stack, xPos, yPos); RenderHelper.disableStandardItemLighting(); GL11.glPopMatrix(); if ((relativeMouseX >= xPos) && (relativeMouseY >= yPos) && (relativeMouseX <= (xPos + 16)) && (relativeMouseY <= (yPos + 16))) { tooltipStack = stack; final EntryData data = HandbookRecipeMappings.getDataForStack(tooltipStack); if ((data != null) && ((data.entry != gui.getEntry()) || (data.page != gui.getPageOn()))) { tooltipEntry = true; if (Mouse.isButtonDown(0)) { final GuiHandbookEntry newGui = new GuiHandbookEntry(data.entry, (GuiScreen) gui); newGui.page = data.page; Minecraft.getMinecraft().displayGuiScreen(newGui); } } if (accountForContainer) { final ItemStack containerStack = stack.getItem().getContainerItem(stack); if ((containerStack != null) && (containerStack.getItem() != null)) tooltipContainerStack = containerStack; } } GL11.glDisable(GL11.GL_LIGHTING); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
public InspectorCanvas(Composite parent, int style, GLData data) { super(parent, style, data); setCurrent();/*from w ww. ja v a 2 s . c om*/ // Clear the canvas. GL11.glClearColor(CLEAR_COLOR[0], CLEAR_COLOR[1], CLEAR_COLOR[2], CLEAR_COLOR[3]); GL11.glClearDepth(1.0f); GL11.glLineWidth(1.0f); GL11.glPointSize(1.0f); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_POLYGON_SMOOTH); GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.01f); GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glStencilFunc(GL11.GL_ALWAYS, 0x1, 0xf); GL11.glStencilOp(GL11.GL_INCR, GL11.GL_KEEP, GL11.GL_INCR); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); reset(); mTransform = new Matrix4f(); mTransform.setIdentity(); addListener(SWT.Resize, this); addListener(SWT.Paint, this); addMouseListener(this); addMouseWheelListener(this); }
From source file:com.sriramramani.droid.inspector.ui.InspectorCanvas.java
License:Mozilla Public License
private void drawImage(Node node, int textureId, boolean isBackground) { GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); loadColor(ColorType.COLOR_WHITE); GL11.glEnable(GL11.GL_TEXTURE_2D);//w w w . j av a 2 s. c om GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f); GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f(node.bounds.width, 0.0f, 0.0f); GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f(node.bounds.width, -node.bounds.height, 0.0f); GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(0.0f, -node.bounds.height, 0.0f); GL11.glEnd(); GL11.glDisable(GL11.GL_TEXTURE_2D); }
From source file:com.stormister.rediscovered.RenderTileEntityTable.java
License:Open Source License
/** * Renders the TileEntity for the chest at a position. *///from w w w . j a v a2s . c o m public void render(TileEntityTable par1TileEntityChest, double par2, double par4, double par6, float par8) { int i; this.bindTexture(field_110871_a); if (!par1TileEntityChest.hasWorldObj()) { i = 0; } else { Block block = par1TileEntityChest.getBlockType(); i = par1TileEntityChest.getBlockMetadata(); if (block instanceof BlockTable && i == 0) { i = par1TileEntityChest.getBlockMetadata(); } } ModelTable modelchest; modelchest = this.chestModel; GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float) par2, (float) par4 + 1.0F, (float) par6 + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short short1 = 0; GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8; float f2; f1 = 1.0F - f1; f1 = 1.0F - f1 * f1 * f1; modelchest.renderAll(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //*********************************************** //RENDERS ITEM ON TABLE //*********************************************** // ItemStack itemstack = par1TileEntityChest.getTopItemStacks(); // // if (itemstack != null) // { // EntityItem entityitem = new EntityItem(par1TileEntityChest.worldObj, 0.0D, 0.0D, 0.0D, itemstack); // entityitem.getEntityItem().stackSize = 1; // entityitem.hoverStart = 0.0F; // GL11.glPushMatrix(); // GL11.glTranslatef(-0.453125F * (float)Direction.offsetX[par1TileEntityChest.hangingDirection], -0.18F, -0.453125F * (float)Direction.offsetZ[par1TileEntityChest.hangingDirection]); // GL11.glRotatef(180.0F + par1TileEntityChest.rotationYaw, 0.0F, 1.0F, 0.0F); // GL11.glRotatef((float)(-90 * par1TileEntityChest.getRotation()), 0.0F, 0.0F, 1.0F); // RenderItem.renderInFrame = true; // RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); // RenderItem.renderInFrame = false; // GL11.glPopMatrix(); // } }
From source file:com.teambr.bookshelf.client.gui.component.BaseComponent.java
License:Creative Commons License
/** * Used to draw a tooltip over this component * * @param tip The list of strings to render * @param mouseX The mouse x Position//from ww w . j a v a2s . c om * @param mouseY The mouse Y position * @param font The font renderer */ protected void drawHoveringText(List<String> tip, int mouseX, int mouseY, FontRenderer font) { if (!tip.isEmpty()) { GL11.glPushMatrix(); GL11.glTranslated(0.0, 0.0, 5); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_DEPTH_TEST); int k = 0; for (String s : tip) { int l = font.getStringWidth(s); if (l > k) { k = l; } } int j2 = mouseX + 12; int k2 = mouseY - 12; int i1 = 8; if (tip.size() > 1) { i1 += 2 + (tip.size() - 1) * 10; } if (j2 + k > parent.width) { j2 -= 28 + k; } if (k2 + i1 + 6 > parent.height) { k2 = this.getHeight() - i1 - 6; } this.zLevel = 300.0F; int j1 = -267386864; this.drawGradientRect(j2 - 3, k2 - 4, j2 + k + 3, k2 - 3, j1, j1); this.drawGradientRect(j2 - 3, k2 + i1 + 3, j2 + k + 3, k2 + i1 + 4, j1, j1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + i1 + 3, j1, j1); this.drawGradientRect(j2 + k + 3, k2 - 3, j2 + k + 4, k2 + i1 + 3, j1, j1); int k1 = 1347420415; int l1 = (k1 & 16711422) >> 1 | k1 & -16777216; this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 + k + 2, k2 - 3 + 1, j2 + k + 3, k2 + i1 + 3 - 1, k1, l1); this.drawGradientRect(j2 - 3, k2 - 3, j2 + k + 3, k2 - 3 + 1, k1, k1); this.drawGradientRect(j2 - 3, k2 + i1 + 2, j2 + k + 3, k2 + i1 + 3, l1, l1); for (String s1 : tip) { font.drawStringWithShadow(s1, j2, k2, -1); if (s1.equals(tip.get(0))) k2 += 2; k2 += 10; } this.zLevel = 0.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_DEPTH_TEST); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); } }
From source file:com.teambr.bookshelf.client.gui.component.control.GuiComponentTextBox.java
License:Creative Commons License
/** * Called to render the component//from ww w . ja v a 2 s .com */ @Override public void render(int guiLeft, int guiTop, int mouseX, int mouseY) { GlStateManager.pushMatrix(); textField.drawTextBox(); GlStateManager.disableAlpha(); GL11.glDisable(GL11.GL_ALPHA_TEST); GlStateManager.popMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.display.GuiReverseTab.java
License:Creative Commons License
/** * Called to render the component/*from w ww . j a va 2 s . c om*/ */ @Override public void render(int guiLeft, int guiTop, int mouseX, int mouseY) { GlStateManager.pushMatrix(); // Set targets to stun double targetWidth = isActive ? expandedWidth : FOLDED_SIZE; double targetHeight = isActive ? expandedHeight : FOLDED_SIZE; // Move size if (currentWidth != targetWidth) dWidth += (targetWidth - dWidth); if (currentHeight != targetHeight) dHeight += (targetHeight - dHeight); // Set size currentWidth = dWidth; currentHeight = dHeight; // Render the tab tabRenderer.render(this, -currentWidth, 0, currentWidth, currentHeight); // Render the stack, if available RenderUtils.restoreColor(); if (stack != null) { RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); itemRenderer.renderItemAndEffectIntoGUI(stack, -21, 3); RenderUtils.restoreColor(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); } // Render the children if (areChildrenActive()) { GlStateManager.translate(-expandedWidth, 0, 0); children.forEach((component -> { RenderUtils.prepareRenderState(); component.render(-expandedWidth, 0, mouseX, mouseY); RenderUtils.restoreColor(); RenderUtils.restoreRenderState(); })); } GlStateManager.popMatrix(); }
From source file:com.teambr.bookshelf.client.gui.component.display.GuiTab.java
License:Creative Commons License
/** * Called to render the component//w w w .j a v a 2 s . c o m */ @Override public void render(int guiLeft, int guiTop, int mouseX, int mouseY) { GlStateManager.pushMatrix(); // Set targets to stun double targetWidth = isActive ? expandedWidth : FOLDED_SIZE; double targetHeight = isActive ? expandedHeight : FOLDED_SIZE; // Move size if (currentWidth != targetWidth) dWidth += (targetWidth - dWidth); if (currentHeight != targetHeight) dHeight += (targetHeight - dHeight); // Set size currentWidth = dWidth; currentHeight = dHeight; // Render the tab tabRenderer.render(this, 0, 0, currentWidth, currentHeight); // Render the stack, if available RenderUtils.restoreColor(); if (stack != null) { RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); itemRenderer.renderItemAndEffectIntoGUI(stack, 4, 3); RenderUtils.restoreColor(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_LIGHTING); } // Render the children if (areChildrenActive()) { children.forEach((component -> { RenderUtils.prepareRenderState(); component.render(0, 0, mouseX, mouseY); RenderUtils.restoreColor(); RenderUtils.restoreRenderState(); })); } GlStateManager.popMatrix(); }