Java Code Examples for net.minecraft.client.render.Tessellator#getInstance()
The following examples show how to use
net.minecraft.client.render.Tessellator#getInstance() .
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: HallowedLoadingScreen.java From the-hallow with MIT License | 6 votes |
@Override public void renderDirtBackground(int i) { // Copied mostly from renderDirtBackground() RenderSystem.disableLighting(); RenderSystem.disableFog(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder builder = tessellator.getBuffer(); minecraft.getTextureManager().bindTexture(backgroundTexture); int brightness = 130; RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); builder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR); builder.vertex(0, height, 0).texture(0, height / 32.0F + i).color(brightness, brightness, brightness, 255).next(); builder.vertex(width, height, 0).texture(width / 32.0F, height / 32.0F + i).color(brightness, brightness, brightness, 255).next(); builder.vertex(width, 0, 0).texture(width / 32.0F, i).color(brightness, brightness, brightness, 255).next(); builder.vertex(0, 0, 0).texture(0, i).color(brightness, brightness, brightness, 255).next(); tessellator.draw(); }
Example 2
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawText(String str, double x, double y, double z, double scale) { glSetup(x, y, z); GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale); int i = mc.textRenderer.getStringWidth(str) / 2; GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, VertexFormats.POSITION_COLOR); float f = mc.options.getTextBackgroundOpacity(0.25F); bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); mc.textRenderer.draw(str, -i, 0, 553648127); mc.textRenderer.draw(str, -i, 0, -1); glCleanup(); }
Example 3
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawText(String str, double x, double y, double z, double scale) { glSetup(x, y, z); GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale); int i = mc.textRenderer.getWidth(str) / 2; GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, VertexFormats.POSITION_COLOR); float f = mc.options.getTextBackgroundOpacity(0.25F); bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); mc.textRenderer.draw(new MatrixStack(), str, -i, 0, 553648127); mc.textRenderer.draw(new MatrixStack(), str, -i, 0, -1); glCleanup(); }
Example 4
Source File: RenderUtilsLiving.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawText(String str, double x, double y, double z, double scale) { glSetup(x, y, z); GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale); int i = mc.textRenderer.getStringWidth(str) / 2; GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBufferBuilder(); bufferbuilder.begin(7, VertexFormats.POSITION_COLOR); float f = mc.options.getTextBackgroundOpacity(0.25F); bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next(); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); mc.textRenderer.draw(str, -i, 0, 553648127); mc.textRenderer.draw(str, -i, 0, -1); glCleanup(); }
Example 5
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 6 votes |
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) { gl11Setup(); GL11.glLineWidth(t); Vec3d ren = renderPos(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBufferBuilder(); buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 0.0F).next(); buffer.vertex(x1 - ren.x, y1 - ren.y, z1 - ren.z).color(r, g, b, 1.0F).next(); buffer.vertex(x2 - ren.x, y2 - ren.y, z2 - ren.z).color(r, g, b, 1.0F).next(); tessellator.draw(); gl11Cleanup(); }
Example 6
Source File: WTextField.java From LibGui with MIT License | 6 votes |
@Environment(EnvType.CLIENT) private void invertedRect(int x, int y, int width, int height) { Tessellator tessellator_1 = Tessellator.getInstance(); BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer(); RenderSystem.color4f(0.0F, 0.0F, 255.0F, 255.0F); RenderSystem.disableTexture(); RenderSystem.enableColorLogicOp(); RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE); bufferBuilder_1.begin(GL11.GL_QUADS, VertexFormats.POSITION); bufferBuilder_1.vertex(x, y+height, 0.0D).next(); bufferBuilder_1.vertex(x+width, y+height, 0.0D).next(); bufferBuilder_1.vertex(x+width, y, 0.0D).next(); bufferBuilder_1.vertex(x, y, 0.0D).next(); tessellator_1.draw(); RenderSystem.disableColorLogicOp(); RenderSystem.enableTexture(); }
Example 7
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 8
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 9
Source File: ListWidget.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
protected void renderHoleBackground(int top, int bottom, int topAlpha, int bottomAlpha) { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); client.getTextureManager() .bindTexture(DrawableHelper.BACKGROUND_TEXTURE); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); bufferBuilder.begin(7, VertexFormats.POSITION_TEXTURE_COLOR); bufferBuilder.vertex(left, bottom, 0.0D).texture(0.0F, bottom / 32.0F) .color(64, 64, 64, bottomAlpha).next(); bufferBuilder.vertex(left + width, bottom, 0.0D) .texture(width / 32.0F, bottom / 32.0F) .color(64, 64, 64, bottomAlpha).next(); bufferBuilder.vertex(left + width, top, 0.0D) .texture(width / 32.0F, top / 32.0F).color(64, 64, 64, topAlpha) .next(); bufferBuilder.vertex(left, top, 0.0D).texture(0.0F, top / 32.0F) .color(64, 64, 64, topAlpha).next(); tessellator.draw(); }
Example 10
Source File: RenderUtilImpl.java From Sandbox with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void drawRepeating(int x, int y, int u, int v, int width, int height, float repeatWidth, float repeatHeight, int texWidth, int texHeight) { GlStateManager.disableLighting(); GlStateManager.disableFog(); Tessellator tessellator_1 = Tessellator.getInstance(); BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer(); GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR_TEXTURE); bufferBuilder_1.vertex(x, y + height, 0.0D).color(255, 255, 255, 255).texture(u / (float) texWidth, (v + repeatHeight) / (float) texHeight).next(); bufferBuilder_1.vertex(x + width, y + height, 0.0D).color(255, 255, 255, 255).texture((u + repeatWidth) / (float) texWidth, (float) (v + repeatHeight) / (float) texHeight).next(); bufferBuilder_1.vertex(x + width, y, 0.0D).color(255, 255, 255, 255).texture((u + repeatWidth) / (float) texWidth, v / (float) texHeight).next(); bufferBuilder_1.vertex(x, y, 0.0D).color(255, 255, 255, 255).texture(u / (float) texWidth, v / (float) texHeight).next(); tessellator_1.draw(); }
Example 11
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawFilledBox(Box box, float r, float g, float b, float a) { gl11Setup(); Vec3d ren = renderPos(); /* Fill */ Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBufferBuilder(); buffer.begin(5, VertexFormats.POSITION_COLOR); WorldRenderer.buildBox(buffer, box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z, box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z, r, g, b, a/2f); tessellator.draw(); /* Outline */ WorldRenderer.drawBoxOutline(new Box( box.minX - ren.x, box.minY - ren.y, box.minZ - ren.z, box.maxX - ren.x, box.maxY - ren.y, box.maxZ - ren.z), r, g, b, a); gl11Cleanup(); }
Example 12
Source File: Window.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
private void fillGradient(int x1, int y1, int x2, int y2, int color1, int color2) { float float_1 = (float)(color1 >> 24 & 255) / 255.0F; float float_2 = (float)(color1 >> 16 & 255) / 255.0F; float float_3 = (float)(color1 >> 8 & 255) / 255.0F; float float_4 = (float)(color1 & 255) / 255.0F; float float_5 = (float)(color2 >> 24 & 255) / 255.0F; float float_6 = (float)(color2 >> 16 & 255) / 255.0F; float float_7 = (float)(color2 >> 8 & 255) / 255.0F; float float_8 = (float)(color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glShadeModel(7425); Tessellator tessellator_1 = Tessellator.getInstance(); BufferBuilder bufferBuilder_1 = tessellator_1.getBufferBuilder(); bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR); bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next(); bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next(); tessellator_1.draw(); GL11.glShadeModel(7424); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 13
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawFilledBox(Box box, float r, float g, float b, float a) { gl11Setup(); // Fill Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(5, VertexFormats.POSITION_COLOR); WorldRenderer.drawBox(buffer, box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ, r, g, b, a/2f); tessellator.draw(); // Outline buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(box.minX, box.minY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.minY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, b, b, a/2f).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, b, b, 0f).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, b, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, b, b, a/2f).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, b, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, b, b, a/2f).next(); tessellator.draw(); gl11Cleanup(); }
Example 14
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) { gl11Setup(); GL11.glLineWidth(t); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(x1, y1, z1).color(r, g, b, 0.0F).next(); buffer.vertex(x1, y1, z1).color(r, g, b, 1.0F).next(); buffer.vertex(x2, y2, z2).color(r, g, b, 1.0F).next(); tessellator.draw(); gl11Cleanup(); }
Example 15
Source File: Window.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
protected void fillGradient(MatrixStack matrix, int x1, int y1, int x2, int y2, int color1, int color2) { float float_1 = (float)(color1 >> 24 & 255) / 255.0F; float float_2 = (float)(color1 >> 16 & 255) / 255.0F; float float_3 = (float)(color1 >> 8 & 255) / 255.0F; float float_4 = (float)(color1 & 255) / 255.0F; float float_5 = (float)(color2 >> 24 & 255) / 255.0F; float float_6 = (float)(color2 >> 16 & 255) / 255.0F; float float_7 = (float)(color2 >> 8 & 255) / 255.0F; float float_8 = (float)(color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glShadeModel(7425); Tessellator tessellator_1 = Tessellator.getInstance(); BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer(); bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR); bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next(); bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next(); tessellator_1.draw(); GL11.glShadeModel(7424); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 16
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawFilledBox(Box box, float r, float g, float b, float a) { gl11Setup(); // Fill Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(5, VertexFormats.POSITION_COLOR); WorldRenderer.drawBox(buffer, box.x1, box.y1, box.z1, box.x2, box.y2, box.z2, r, g, b, a/2f); tessellator.draw(); // Outline buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(box.x1, box.y1, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y1, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y1, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y1, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y1, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y2, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y2, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y2, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y2, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y2, box.z1).color(r, b, b, a/2f).next(); buffer.vertex(box.x1, box.y1, box.z2).color(r, b, b, 0f).next(); buffer.vertex(box.x1, box.y2, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y1, box.z2).color(r, b, b, 0f).next(); buffer.vertex(box.x2, box.y2, box.z2).color(r, b, b, a/2f).next(); buffer.vertex(box.x2, box.y1, box.z1).color(r, b, b, 0f).next(); buffer.vertex(box.x2, box.y2, box.z1).color(r, b, b, a/2f).next(); tessellator.draw(); gl11Cleanup(); }
Example 17
Source File: RenderUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void drawLine(double x1,double y1,double z1,double x2,double y2,double z2, float r, float g, float b, float t) { gl11Setup(); GL11.glLineWidth(t); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(x1, y1, z1).color(r, g, b, 0.0F).next(); buffer.vertex(x1, y1, z1).color(r, g, b, 1.0F).next(); buffer.vertex(x2, y2, z2).color(r, g, b, 1.0F).next(); tessellator.draw(); gl11Cleanup(); }
Example 18
Source File: Window.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
protected void fillGradient(int x1, int y1, int x2, int y2, int color1, int color2) { float float_1 = (float)(color1 >> 24 & 255) / 255.0F; float float_2 = (float)(color1 >> 16 & 255) / 255.0F; float float_3 = (float)(color1 >> 8 & 255) / 255.0F; float float_4 = (float)(color1 & 255) / 255.0F; float float_5 = (float)(color2 >> 24 & 255) / 255.0F; float float_6 = (float)(color2 >> 16 & 255) / 255.0F; float float_7 = (float)(color2 >> 8 & 255) / 255.0F; float float_8 = (float)(color2 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glShadeModel(7425); Tessellator tessellator_1 = Tessellator.getInstance(); BufferBuilder bufferBuilder_1 = tessellator_1.getBuffer(); bufferBuilder_1.begin(7, VertexFormats.POSITION_COLOR); bufferBuilder_1.vertex((double)x1, (double)y1, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x1, (double)y2, 0).color(float_2, float_3, float_4, float_1).next(); bufferBuilder_1.vertex((double)x2, (double)y2, 0).color(float_6, float_7, float_8, float_5).next(); bufferBuilder_1.vertex((double)x2, (double)y1, 0).color(float_6, float_7, float_8, float_5).next(); tessellator_1.draw(); GL11.glShadeModel(7424); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 19
Source File: ShapesRenderer.java From fabric-carpet with MIT License | 4 votes |
public void render(Camera camera, float partialTick) { IWorld iWorld = this.client.world; DimensionType dimensionType = iWorld.getDimension().getType(); if (shapes.get(dimensionType) == null || shapes.get(dimensionType).isEmpty()) return; long currentTime = client.world.getTime(); RenderSystem.disableTexture(); RenderSystem.enableDepthTest(); RenderSystem.depthFunc(515); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); //RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); //RenderSystem.shadeModel(7425); RenderSystem.shadeModel(GL11.GL_FLAT); RenderSystem.enableAlphaTest(); RenderSystem.alphaFunc(GL11.GL_GREATER, 0.003f); RenderSystem.disableCull(); RenderSystem.disableLighting(); RenderSystem.depthMask(false); //RenderSystem.polygonOffset(-3f, -3f); //RenderSystem.enablePolygonOffset(); //Entity entity = this.client.gameRenderer.getCamera().getFocusedEntity(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); // render double cameraX = camera.getPos().x; double cameraY = camera.getPos().y; double cameraZ = camera.getPos().z; synchronized (shapes) { shapes.get(dimensionType).long2ObjectEntrySet().removeIf( entry -> entry.getValue().isExpired(currentTime) ); shapes.get(dimensionType).values().forEach( s -> { if ( s.shouldRender(dimensionType)) s.renderFaces(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick); } ); //lines shapes.get(dimensionType).values().forEach( s -> { if ( s.shouldRender(dimensionType)) s.renderLines(tessellator, bufferBuilder, cameraX, cameraY, cameraZ, partialTick); } ); } RenderSystem.enableCull(); RenderSystem.depthMask(true); RenderSystem.lineWidth(1.0F); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); RenderSystem.enableTexture(); RenderSystem.shadeModel(7424); }
Example 20
Source File: ListWidget.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
protected void renderList(MatrixStack matrixStack, int i, int j, int k, int l, float f) { int m = getItemCount(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); for(int n = 0; n < m; ++n) { int o = j + n * itemHeight + headerHeight; int p = itemHeight - 4; if(o > bottom || o + p < top) updateItemPosition(n, i, o, f); if(renderSelection && isSelectedItem(n)) { int q = left + width / 2 - getRowWidth() / 2; int r = left + width / 2 + getRowWidth() / 2; RenderSystem.disableTexture(); float g = isFocused() ? 1.0F : 0.5F; RenderSystem.color4f(g, g, g, 1.0F); bufferBuilder.begin(7, VertexFormats.POSITION); bufferBuilder.vertex(q, o + p + 2, 0.0D).next(); bufferBuilder.vertex(r, o + p + 2, 0.0D).next(); bufferBuilder.vertex(r, o - 2, 0.0D).next(); bufferBuilder.vertex(q, o - 2, 0.0D).next(); tessellator.draw(); RenderSystem.color4f(0.0F, 0.0F, 0.0F, 1.0F); bufferBuilder.begin(7, VertexFormats.POSITION); bufferBuilder.vertex(q + 1, o + p + 1, 0.0D).next(); bufferBuilder.vertex(r - 1, o + p + 1, 0.0D).next(); bufferBuilder.vertex(r - 1, o - 1, 0.0D).next(); bufferBuilder.vertex(q + 1, o - 1, 0.0D).next(); tessellator.draw(); RenderSystem.enableTexture(); } renderItem(matrixStack, n, i, o, p, k, l, f); } }