Java Code Examples for net.minecraft.client.renderer.GlStateManager#popAttrib()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#popAttrib() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FramebufferShader.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
public void stopDraw(final Color color, final float radius, final float quality) { mc.gameSettings.entityShadows = entityShadows; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); mc.getFramebuffer().bindFramebuffer(true); red = color.getRed() / 255F; green = color.getGreen() / 255F; blue = color.getBlue() / 255F; alpha = color.getAlpha() / 255F; this.radius = radius; this.quality = quality; mc.entityRenderer.disableLightmap(); RenderHelper.disableStandardItemLighting(); startShader(); mc.entityRenderer.setupOverlayRendering(); drawFramebuffer(framebuffer); stopShader(); mc.entityRenderer.disableLightmap(); GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
Example 2
Source File: RenderSeedAnalyzer.java From AgriCraft with MIT License | 6 votes |
private void renderSeed(TileEntitySeedAnalyzer te, double x, double y, double z) { if (te != null && te.hasSpecimen()) { // Save Settings GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); // Translate to the location of our tile entity GlStateManager.translate(x, y, z); GlStateManager.disableRescaleNormal(); // Render Seed Item renderItemStack(te.getSpecimen(), 0.5, 0.5, 0.5, 0.75, true); // Restore Settings GlStateManager.popMatrix(); GlStateManager.popAttrib(); } }
Example 3
Source File: RenderPeripheral.java From AgriCraft with MIT License | 6 votes |
private void renderSeed(TileEntitySeedAnalyzer te, double x, double y, double z) { if (te != null && te.hasSpecimen()) { // Save Settings GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); // Translate to the location of our tile entity GlStateManager.translate(x, y, z); GlStateManager.disableRescaleNormal(); // Render Seed Item renderItemStack(te.getSpecimen(), 0.5, 0.5, 0.5, 0.75, true); // Restore Settings GlStateManager.popMatrix(); GlStateManager.popAttrib(); } }
Example 4
Source File: AgriGuiWrapper.java From AgriCraft with MIT License | 6 votes |
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { // Calculate relative mouse position. final int relMouseX = mouseX - this.guiLeft; final int relMouseY = mouseY - this.guiTop; // Call Mouse Moved Hook. this.guis.getLast().onUpdateMouse(this, relMouseX, relMouseY); // Save renderer state. GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); // Call render hook. this.guis.getLast().onRenderForeground(this, relMouseX, relMouseY); // Restore renderer state. GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
Example 5
Source File: AgriGuiWrapper.java From AgriCraft with MIT License | 6 votes |
@Override protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { // Calculate relative mouse position. final int relMouseX = mouseX - this.guiLeft; final int relMouseY = mouseY - this.guiTop; // Save renderer state. GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); // Translate to gui location. GlStateManager.translate(this.guiLeft, this.guiTop, 0); // Call render hook. this.guis.getLast().onRenderBackground(this, f, relMouseX, relMouseY); // Restore renderer state. GlStateManager.popMatrix(); GlStateManager.popAttrib(); }
Example 6
Source File: RenderHelper.java From HoloInventory with MIT License | 6 votes |
public static void renderName(FontRenderer fr, ItemStack stack, int cols, int col, int rows, int row, int color) { GlStateManager.pushMatrix(); GlStateManager.translate(0.4f * (cols / 2.0 - col) - 0.2f, 0.4f * (rows / 2.0 - row) - 0.15f, 0); GlStateManager.pushAttrib(); GlStateManager.rotate(180, 0, 0, 1); GlStateManager.translate(0.2, 0, -0.1); GlStateManager.scale(0.01, 0.01, 0.01); String size; if (stack.getCount() < 1000) size = String.valueOf(stack.getCount()); else if (stack.getCount() > 1000) size = ClientEventHandler.DF.format(stack.getCount() / 1000.0) + "k"; else size = ClientEventHandler.DF.format(stack.getCount() / (1000.0 * 1000.0)) + "M"; int w = fr.getStringWidth(size); fr.drawStringWithShadow(size, -w, 0, color); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
Example 7
Source File: RenderHelper.java From HoloInventory with MIT License | 6 votes |
public static void renderStack(RenderItem ri, ItemStack stack, int cols, int col, int rows, int row) { GlStateManager.pushMatrix(); GlStateManager.pushAttrib(); GlStateManager.translate(0.4f * (cols / 2.0 - col) - 0.2f, 0.4f * (rows / 2.0 - row), 0); GlStateManager.pushMatrix(); GlStateManager.rotate((float) (360.0 * (double) (System.currentTimeMillis() & 0x3FFFL) / (double) 0x3FFFL), 0, 1, 0); GlStateManager.scale(0.45, 0.45, 0.45); ri.renderItem(stack, ItemCameraTransforms.TransformType.FIXED); if (stack.hasEffect()) { GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); } GlStateManager.popMatrix(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
Example 8
Source File: RenderUtils.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawFilledCircle(int x, int y, float radius, int color) { GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableTexture2D(); GL11.glBegin(GL11.GL_TRIANGLE_FAN); for (int i = 0; i < 50; i++) { float px = x + radius * MathHelper.sin((float) (i * (6.28318530718 / 50))); float py = y + radius * MathHelper.cos((float) (i * (6.28318530718 / 50))); float alpha = (color >> 24 & 255) / 255.0F; float red = (color >> 16 & 255) / 255.0F; float green = (color >> 8 & 255) / 255.0F; float blue = (color & 255) / 255.0F; GL11.glColor4f(red, green, blue, alpha); GL11.glVertex2d(px, py); } GL11.glEnd(); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); GlStateManager.bindTexture(0); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); }
Example 9
Source File: CivilizationOverlayHandler.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private void drawCivilizationBadge(CivilizationType civType) { int badgeX = determineBadgeX(); int badgeY = determineIconY(); GlStateManager.pushAttrib(); GlStateManager.disableDepth(); GlStateManager.enableBlend(); ToroGuiUtils.drawOverlayIcon(mc, badgeX - 2, badgeY, 0, 96, 20, 27); ToroGuiUtils.drawOverlayIcon(mc, badgeX, badgeY + 3, iconIndex(civType), 0); GlStateManager.popAttrib(); GlStateManager.enableDepth(); GlStateManager.disableBlend(); }
Example 10
Source File: ComponentGui.java From AgriCraft with MIT License | 5 votes |
@Override public final synchronized void onRenderBackground(AgriGuiWrapper wrapper, float f, int relMouseX, int relMouseY) { GlStateManager.pushAttrib(); GlStateManager.color(1, 1, 1, 1); for (ResourceLocation r : backgrounds) { Minecraft.getMinecraft().getTextureManager().bindTexture(r); wrapper.drawTexturedModalRect(0, 0, 0, 0, this.width, this.height); } GlStateManager.popAttrib(); }
Example 11
Source File: GuiComponent.java From AgriCraft with MIT License | 5 votes |
public final void renderComponent(AgriGuiWrapper gui) { if (this.isVisible && this.renderAction != null) { GlStateManager.pushAttrib(); GlStateManager.pushMatrix(); GlStateManager.translate(this.bounds.x, this.bounds.y, 0); GlStateManager.scale(scale, scale, scale); GlStateManager.color(1, 1, 1, 1); this.renderAction.accept(gui, this); GlStateManager.popMatrix(); GlStateManager.popAttrib(); } }
Example 12
Source File: RenderHelper.java From HoloInventory with MIT License | 5 votes |
public static void end() { GlStateManager.disableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.disableLighting(); GlStateManager.popAttrib(); GlStateManager.popMatrix(); }
Example 13
Source File: WrapperGlStateManager.java From ClientBase with MIT License | 4 votes |
public static void popAttrib() { GlStateManager.popAttrib(); }
Example 14
Source File: TESRBarrel.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
protected void renderStack(ItemStack stack, double posX, double posY, double posZ, EnumFacing side, EnumFacing barrelFront) { GlStateManager.pushMatrix(); GlStateManager.translate(posX, posY, posZ); if (side == EnumFacing.UP || side == EnumFacing.DOWN) { GlStateManager.rotate(MODEL_ROT_SIDE_Y[barrelFront.getIndex()], 0, 1, 0); GlStateManager.rotate(-90f * side.getYOffset(), 1, 0, 0); } else { GlStateManager.rotate(MODEL_ROT_SIDE_Y[side.getIndex()], 0, 1, 0); } //GlStateManager.translate(-0.25, 0.2, 0); // This offset is currently added to the renderItemIntoGUI arguments GlStateManager.scale(0.55f, 0.55f, 1); if (this.renderItem.shouldRenderItemIn3D(stack)) { GlStateManager.scale(1 / 16f, -1 / 16f, 0.0001); } else { GlStateManager.scale(1 / 16f, -1 / 16f, 0.01); GlStateManager.translate(0, 0, -100); } // The following rendering stuff within this method has been taken from Storage Drawers by jaquadro, found here: // https://github.com/jaquadro/StorageDrawers/blob/e5719be6d64f757a1b58c25e8ca5bc64074c6b9e/src/com/jaquadro/minecraft/storagedrawers/client/renderer/TileEntityDrawersRenderer.java#L180 // At the time GL_LIGHT* are configured, the coordinates are transformed by the modelview // matrix. The transformations used in `RenderHelper.enableGUIStandardItemLighting` are // suitable for the orthographic projection used by GUI windows, but they are just a little // bit off when rendering a block in 3D and squishing it flat. An additional term is added // to account for slightly different shading on the half-size "icons" in 1x2 and 2x2 // drawers due to the extreme angles caused by flattening the block (as noted below). GlStateManager.pushMatrix(); GlStateManager.scale(2.6f, 2.6f, 1); GlStateManager.rotate(171.6f, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(84.9f, 1.0F, 0.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); // TileEntitySkullRenderer alters both of these options on, but does not restore them. GlStateManager.enableCull(); // This extra enable toggle is to fix a render glitch with items in Item Frames on screen, // and then hovering over a stack in an inventory... Rendering... always lovely... GlStateManager.enableRescaleNormal(); GlStateManager.disableRescaleNormal(); // GL_POLYGON_OFFSET is used to offset flat icons toward the viewer (-Z) in screen space, // so they always appear on top of the drawer's front space. GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(-1, -1); // DIRTY HACK: Fool GlStateManager into thinking GL_RESCALE_NORMAL is enabled, but disable // it using popAttrib This prevents RenderItem from enabling it again. // // Normals are transformed by the inverse of the modelview and projection matrices that // excludes the translate terms. When put through the extreme Z scale used to flatten the // block, this makes them point away from the drawer face at a very sharp angle. These // normals are no longer unit scale (normalized), and normalizing them via // GL_RESCALE_NORMAL causes a loss of precision that results in the normals pointing // directly away from the face, which is visible as the block faces having identical // (dark) shading. GlStateManager.pushAttrib(); GlStateManager.enableRescaleNormal(); GlStateManager.popAttrib(); this.renderItem.renderItemIntoGUI(stack, -8, -7); GlStateManager.disableBlend(); // Clean up after RenderItem GlStateManager.enableAlpha(); // Restore world render state after RenderItem GlStateManager.disablePolygonOffset(); GlStateManager.popMatrix(); }