Java Code Examples for com.mojang.blaze3d.systems.RenderSystem#disableBlend()
The following examples show how to use
com.mojang.blaze3d.systems.RenderSystem#disableBlend() .
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: SpaceRaceScreen.java From Galacticraft-Rewoven with MIT License | 6 votes |
private void renderButton(MatrixStack stack, TextRenderer textRenderer, Text text, int x, int y, int width, int height) { RenderSystem.disableBlend(); stack.push(); fillSolid(stack.peek().getModel(), x, y, x + width, y + height, 0x0); drawHorizontalLineSolid(stack, x, x + width, y, 0x2d2d2d); drawVerticalLineSolid(stack, x + width, y, y + height, 0x2d2d2d); drawHorizontalLineSolid(stack, x + width, x, y + height, 0x2d2d2d); drawVerticalLineSolid(stack, x, y, y + height, 0x2d2d2d); stack.pop(); RenderSystem.enableBlend(); textRenderer.draw(stack, text, x + (width / 2F) - (textRenderer.getWidth(text) / 2F), y + (height / 2F) - 4F, 0xffffff); }
Example 2
Source File: ScreenDrawing.java From LibGui with MIT License | 6 votes |
/** * Draws a textured rectangle. * * @param x the x coordinate of the box on-screen * @param y the y coordinate of the box on-screen * @param width the width of the box on-screen * @param height the height of the box on-screen * @param texture the Identifier for the texture * @param u1 the left edge of the texture * @param v1 the top edge of the texture * @param u2 the right edge of the texture * @param v2 the bottom edge of the texture * @param color a color to tint the texture. This can be transparent! Use 0xFF_FFFFFF if you don't want a color tint * @param opacity opacity of the drawn texture. (0f is fully opaque and 1f is fully visible) * @since 2.0.0 */ public static void texturedRect(int x, int y, int width, int height, Identifier texture, float u1, float v1, float u2, float v2, int color, float opacity) { MinecraftClient.getInstance().getTextureManager().bindTexture(texture); //float scale = 0.00390625F; if (width <= 0) width = 1; if (height <= 0) height = 1; float r = (color >> 16 & 255) / 255.0F; float g = (color >> 8 & 255) / 255.0F; float b = (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); RenderSystem.enableBlend(); //GlStateManager.disableTexture2D(); RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR_TEXTURE); //I thought GL_QUADS was deprecated but okay, sure. buffer.vertex(x, y + height, 0).color(r, g, b, opacity).texture(u1, v2).next(); buffer.vertex(x + width, y + height, 0).color(r, g, b, opacity).texture(u2, v2).next(); buffer.vertex(x + width, y, 0).color(r, g, b, opacity).texture(u2, v1).next(); buffer.vertex(x, y, 0).color(r, g, b, opacity).texture(u1, v1).next(); tessellator.draw(); //GlStateManager.enableTexture2D(); RenderSystem.disableBlend(); }
Example 3
Source File: ScreenDrawing.java From LibGui with MIT License | 6 votes |
/** * Draws an untextured rectangle of the specified RGB color. */ public static void coloredRect(int left, int top, int width, int height, int color) { if (width <= 0) width = 1; if (height <= 0) height = 1; float a = (color >> 24 & 255) / 255.0F; float r = (color >> 16 & 255) / 255.0F; float g = (color >> 8 & 255) / 255.0F; float b = (color & 255) / 255.0F; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR); //I thought GL_QUADS was deprecated but okay, sure. buffer.vertex(left, top + height, 0.0D).color(r, g, b, a).next(); buffer.vertex(left + width, top + height, 0.0D).color(r, g, b, a).next(); buffer.vertex(left + width, top, 0.0D).color(r, g, b, a).next(); buffer.vertex(left, top, 0.0D).color(r, g, b, a).next(); tessellator.draw(); RenderSystem.enableTexture(); RenderSystem.disableBlend(); }
Example 4
Source File: GuiSelectionScreen.java From XRay-Mod with GNU General Public License v3.0 | 6 votes |
@Override // @mcp: func_230432_a_ = render public void func_230432_a_(MatrixStack stack, int entryIdx, int top, int left, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean p_194999_5_, float partialTicks) { BlockData blockData = this.block; FontRenderer font = Minecraft.getInstance().fontRenderer; // @mcp: func_238407_a_ = drawString font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.getEntryName()), left + 40, top + 7, 0xFFFFFF); font.func_238407_a_(stack, ITextProperties.func_240652_a_(blockData.isDrawing() ? "Enabled" : "Disabled"), left + 40, top + 17, blockData.isDrawing() ? Color.GREEN.getRGB() : Color.RED.getRGB()); RenderHelper.enableStandardItemLighting(); Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(blockData.getItemStack(), left + 15, top + 7); RenderHelper.disableStandardItemLighting(); if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) { this.parent.parent.func_238654_b_( stack, Arrays.asList(new TranslationTextComponent("xray.tooltips.edit1"), new TranslationTextComponent("xray.tooltips.edit2")), left + 15, (entryIdx == this.parent.func_231039_at__().size() - 1 ? (top - (entryHeight - 20)) : (top + (entryHeight + 15))) // @mcp: func_231039_at__ = getEntries ); // @mcp: func_230457_a_ = renderTooltip } RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(GuiSelectionScreen.CIRCLE); GuiBase.drawTexturedQuadFit((left + entryWidth) - 37, top + (entryHeight / 2f) - 9, 14, 14, new int[]{255, 255, 255}, 50f); GuiBase.drawTexturedQuadFit((left + entryWidth) - 35, top + (entryHeight / 2f) - 7, 10, 10, blockData.getColor()); RenderSystem.disableAlphaTest(); RenderSystem.disableBlend(); }
Example 5
Source File: GuiAddBlock.java From XRay-Mod with GNU General Public License v3.0 | 6 votes |
static void renderPreview(int x, int y, float r, float g, float b) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder tessellate = tessellator.getBuffer(); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.color4f(r/255, g/255, b/255, 1); tessellate.begin(7, DefaultVertexFormats.POSITION); tessellate.pos(x, y, 0.0D).endVertex(); tessellate.pos(x, y + 45, 0.0D).endVertex(); tessellate.pos(x + 202, y + 45, 0.0D).endVertex(); tessellate.pos(x + 202, y, 0.0D).endVertex(); tessellator.draw(); RenderSystem.enableTexture(); RenderSystem.disableBlend(); }
Example 6
Source File: SpaceRaceScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
private static void fillSolid(Matrix4f matrix, int x1, int y1, int x2, int y2, int color) { int j; if (x1 < x2) { j = x1; x1 = x2; x2 = j; } if (y1 < y2) { j = y1; y1 = y2; y2 = j; } float f = (float) (color >> 24 & 255) / 255.0F; float g = (float) (color >> 16 & 255) / 255.0F; float h = (float) (color >> 8 & 255) / 255.0F; float k = (float) (color & 255) / 255.0F; BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); RenderSystem.disableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); bufferBuilder.begin(7, VertexFormats.POSITION_COLOR); bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next(); bufferBuilder.end(); BufferRenderer.draw(bufferBuilder); RenderSystem.enableTexture(); }
Example 7
Source File: SpaceRaceScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
private void renderHoveredButton(MatrixStack stack, TextRenderer textRenderer, Text text, int x, int y, int width, int height) { RenderSystem.disableBlend(); stack.push(); fillSolid(stack.peek().getModel(), x, y, x + width, y + height, 0x1e1e1e); drawHorizontalLineSolid(stack, x, x + width, y, 0x3c3c3c); drawVerticalLineSolid(stack, x + width, y, y + height, 0x3c3c3c); drawHorizontalLineSolid(stack, x + width, x, y + height, 0x3c3c3c); drawVerticalLineSolid(stack, x, y, y + height, 0x3c3c3c); stack.pop(); RenderSystem.enableBlend(); textRenderer.draw(stack, text, x + (width / 2F) - (textRenderer.getWidth(text) / 2F), y + (height / 2F) - 4F, 0xffffff); }
Example 8
Source File: Particles_1_12_2.java From multiconnect with MIT License | 5 votes |
@SuppressWarnings("deprecation") @Override public void buildGeometry(VertexConsumer vc, Camera camera, float delta) { if (!(vc instanceof BufferBuilder)) return; float alpha = (ticks + delta) / maxTicks; alpha *= alpha; alpha = 2 - (alpha * 2); if (alpha > 1) alpha = 1; alpha *= 0.2; RenderSystem.disableLighting(); final float radius = 0.125f; Vec3d cameraPos = camera.getPos(); float x = (float) (this.x - cameraPos.getX()); float y = (float) (this.y - cameraPos.getY()); float z = (float) (this.z - cameraPos.getZ()); float light = world.getBrightness(new BlockPos(this.x, this.y, this.z)); textureManager.bindTexture(FOOTPRINT_TEXTURE); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); ((BufferBuilder) vc).begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE_COLOR); vc.vertex(x - radius, y, z + radius).texture(0, 1).color(light, light, light, alpha).next(); vc.vertex(x + radius, y, z + radius).texture(1, 1).color(light, light, light, alpha).next(); vc.vertex(x + radius, y, z - radius).texture(1, 0).color(light, light, light, alpha).next(); vc.vertex(x - radius, y, z - radius).texture(0, 0).color(light, light, light, alpha).next(); Tessellator.getInstance().draw(); RenderSystem.disableBlend(); RenderSystem.enableLighting(); }
Example 9
Source File: Render.java From XRay-Mod with GNU General Public License v3.0 | 5 votes |
@Override public void clean() { RenderSystem.polygonMode( GL_FRONT_AND_BACK, GL_FILL ); RenderSystem.disableBlend(); RenderSystem.enableDepthTest(); RenderSystem.depthMask( true ); RenderSystem.enableTexture(); }
Example 10
Source File: EquineRenderManager.java From MineLittlePony with MIT License | 4 votes |
public static void disableModelRenderProfile() { RenderSystem.disableBlend(); }