com.mojang.blaze3d.platform.GlStateManager Java Examples

The following examples show how to use com.mojang.blaze3d.platform.GlStateManager. 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: ScreenDrawing.java    From LibGui with MIT License 6 votes vote down vote up
/**
 * 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 #2
Source File: ScreenDrawing.java    From LibGui with MIT License 6 votes vote down vote up
/**
 * 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 #3
Source File: WTextField.java    From LibGui with MIT License 6 votes vote down vote up
@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 #4
Source File: GuiAddBlock.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
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 #5
Source File: GuiSelectionScreen.java    From XRay-Mod with GNU General Public License v3.0 6 votes vote down vote up
@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 #6
Source File: TextureUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) {
    GlStateManager.texParameter(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter);
    GlStateManager.texParameter(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter);
    if (target == GL11.GL_TEXTURE_2D) {
        GlStateManager.bindTexture(target);
    } else {
        GL11.glBindTexture(target, texture);
    }

    switch (target) {
        case GL12.GL_TEXTURE_3D:
            GlStateManager.texParameter(target, GL12.GL_TEXTURE_WRAP_R, wrap);
        case GL11.GL_TEXTURE_2D:
            GlStateManager.texParameter(target, GL11.GL_TEXTURE_WRAP_T, wrap);
        case GL11.GL_TEXTURE_1D:
            GlStateManager.texParameter(target, GL11.GL_TEXTURE_WRAP_S, wrap);
    }
}
 
Example #7
Source File: ToggleButton.java    From MiningGadgets with MIT License 6 votes vote down vote up
@Override
public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
    Color activeColor = this.enabled ? Color.GREEN : Color.RED;

    RenderSystem.enableBlend();
    RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param);
    RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);

    RenderSystem.disableTexture();
    RenderSystem.color4f(activeColor.getRed() / 255f, activeColor.getGreen() / 255f, activeColor.getBlue() / 255f, this.enabled ? .4f : .6f);
    blit(this.x, this.y, 0, 0, this.width, this.height);
    RenderSystem.enableTexture();

    RenderSystem.color4f(1f, 1f, 1f, 1f);
    Minecraft.getInstance().getTextureManager().bindTexture(texture);
    blit(this.x +2, this.y + 5, 0, 0, 16, 16, 16, 16);
}
 
Example #8
Source File: GuiEnderItemStorage.java    From EnderStorage with MIT License 6 votes vote down vote up
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
    GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
    TextureUtils.changeTexture(container.chestInv.getSize() == 0 ? "textures/gui/container/dispenser.png" : "textures/gui/container/generic_54.png");
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;

    switch (container.chestInv.getSize()) {
        case 0:
        case 2:
            blit(x, y, 0, 0, xSize, ySize);
            break;
        case 1:
            blit(x, y, 0, 0, xSize, 71);
            blit(x, y + 71, 0, 126, xSize, 96);
            break;

    }
}
 
Example #9
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings ("deprecation")
public void clearRenderState() {
    RenderSystem.popMatrix();
    RenderSystem.matrixMode(GL11.GL_MODELVIEW);
    RenderSystem.popMatrix();//Pop stack here.
    GlStateManager.disableTexGen(GlStateManager.TexGen.S);
    GlStateManager.disableTexGen(GlStateManager.TexGen.T);
    GlStateManager.disableTexGen(GlStateManager.TexGen.R);
    GlStateManager.disableTexGen(GlStateManager.TexGen.Q);
    state.renderStates.forEach(RenderState::clearRenderState);
}
 
Example #10
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
public static void beforeRenderFont(OffsetPoint offsetPoint) {
    disableDepthTest();
    GlStateManager.pushMatrix();
    polygonModeFill();
    GlStateManager.translated(offsetPoint.getX(), offsetPoint.getY() + 0.002D, offsetPoint.getZ());
    GlStateManager.normal3f(0.0F, 1.0F, 0.0F);
    GlStateManager.rotatef(0.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotatef(90.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.scalef(-0.0175F, -0.0175F, 0.0175F);
    enableTexture();
    enableBlend();
    GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    depthMaskTrue();
}
 
Example #11
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 5 votes vote down vote up
public static void beforeRender() {
    enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    lineWidth2();
    disableTexture();
    GlStateManager.disableCull();
    enableDepthTest();

    if (ConfigManager.alwaysVisible.get()) {
        GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
    }
}
 
Example #12
Source File: Render.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void apply()
{
    RenderSystem.disableTexture();
    RenderSystem.disableDepthTest();
    RenderSystem.depthMask( false );
    RenderSystem.polygonMode( GL_FRONT_AND_BACK, GL_LINE );
    RenderSystem.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA );
    RenderSystem.enableBlend();
    RenderSystem.lineWidth( (float) Configuration.general.outlineThickness.get().doubleValue() );
}
 
Example #13
Source File: RenderCustomEndPortal.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings ("deprecation")
public void setupRenderState() {
    state.renderStates.forEach(RenderState::setupRenderState);
    RenderSystem.disableLighting();
    RenderSystem.pushMatrix();//Apply stack here.
    mat.glApply();
    RenderSystem.pushMatrix();
    GlStateManager.translated(projectedView.x, f11, projectedView.z);
    GlStateManager.texGenMode(GlStateManager.TexGen.S, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.T, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.R, GL11.GL_OBJECT_LINEAR);
    GlStateManager.texGenMode(GlStateManager.TexGen.Q, GL11.GL_EYE_LINEAR);
    GlStateManager.texGenParam(GlStateManager.TexGen.S, GL11.GL_OBJECT_PLANE, bufferTexData(1.0F, 0.0F, 0.0F, 0.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.T, GL11.GL_OBJECT_PLANE, bufferTexData(0.0F, 0.0F, 1.0F, 0.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.R, GL11.GL_OBJECT_PLANE, bufferTexData(0.0F, 0.0F, 0.0F, 1.0F));
    GlStateManager.texGenParam(GlStateManager.TexGen.Q, GL11.GL_EYE_PLANE, bufferTexData(0.0F, 1.0F, 0.0F, 0.0F));
    GlStateManager.enableTexGen(GlStateManager.TexGen.S);
    GlStateManager.enableTexGen(GlStateManager.TexGen.T);
    GlStateManager.enableTexGen(GlStateManager.TexGen.R);
    GlStateManager.enableTexGen(GlStateManager.TexGen.Q);
    RenderSystem.popMatrix();
    RenderSystem.matrixMode(GL11.GL_TEXTURE);
    RenderSystem.pushMatrix();
    RenderSystem.loadIdentity();
    RenderSystem.translatef(0.0F, System.currentTimeMillis() % 700000L / 700000F, 0.0F);
    RenderSystem.scalef(f6, f6, f6);
    RenderSystem.translatef(0.5F, 0.5F, 0.0F);
    RenderSystem.rotatef((idx * idx * 4321 + idx * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
    RenderSystem.translatef(-0.5F, -0.5F, 0.0F);
    RenderSystem.translated(-projectedView.x, -projectedView.z, -projectedView.y);
    float f92 = f8 + (float) projectedView.y;
    RenderSystem.translated((projectedView.x * f5) / f92, (projectedView.z * f5) / f92, -projectedView.y + 20);
}
 
Example #14
Source File: DireButton.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    if (this.visible) {
        FontRenderer fontrenderer = Minecraft.getInstance().fontRenderer;
        Minecraft.getInstance().getTextureManager().bindTexture(WIDGETS_LOCATION);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.isHovered = isMouseOver(mouseX, mouseY);
        RenderSystem.enableBlend();
        RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param, GlStateManager.SourceFactor.ONE.param, GlStateManager.DestFactor.ZERO.param);
        RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);
        this.blit(this.x, this.y, 0, 46, this.width / 2, this.height);
        this.blit(this.x + this.width / 2, this.y, 200 - this.width / 2, 46, this.width / 2, this.height);


        int bottomToDraw = 2;
        this.blit(this.x, this.y + this.height - bottomToDraw, 0, 66 - bottomToDraw, this.width / 2, bottomToDraw);
        this.blit(this.x + this.width / 2, this.y + this.height - bottomToDraw, 200 - this.width / 2, 66 - bottomToDraw, this.width / 2, bottomToDraw);

        int j = 14737632;

        if (this.packedFGColor != 0) {
            j = this.packedFGColor;
        } else if (!this.active) {
            j = 10526880;
        } else if (this.isHovered) {
            j = 16777120;
        }

        this.drawCenteredString(fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 7) / 2, j);
    }
}
 
Example #15
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onGuiDraw(GuiScreenEvent.DrawScreenEvent.Post event) {
	if (!(event.getGui() instanceof ContainerScreen<?>)) return;
	ContainerScreen<?> screen = (ContainerScreen<?>) event.getGui();
	
	if (screen.getSlotUnderMouse() == null) return;
	if (!(screen.getSlotUnderMouse().getStack().getItem() instanceof BlockItem)) return;
	if (!(((BlockItem) screen.getSlotUnderMouse().getStack().getItem()).getBlock() instanceof ContainerBlock)) return;
	
	NonNullList<ItemStack> items = NonNullList.withSize(27, new ItemStack(Items.AIR));
	CompoundNBT nbt = screen.getSlotUnderMouse().getStack().getTag();
	
	if (nbt != null && nbt.contains("BlockEntityTag")) {
		CompoundNBT itemnbt = nbt.getCompound("BlockEntityTag");
		if (itemnbt.contains("Items")) ItemStackHelper.loadAllItems(itemnbt, items);
	}
	
	GlStateManager.translatef(0.0F, 0.0F, 500.0F);
	Block block = ((BlockItem) screen.getSlotUnderMouse().getStack().getItem()).getBlock();
	
	int count = block instanceof HopperBlock || block instanceof DispenserBlock ? 18 : 0;
	for (ItemStack i: items) {
		if (count > 26) break;
		int x = event.getMouseX() + 8 + (17 * (count % 9));
		int y = event.getMouseY() - 68 + (17 * (count / 9));
		
		if (i.getItem() != Items.AIR) {
			Screen.fill(x, y, x+17, y+17, 0x90000000);
			Screen.fill(x, y, x+17, y+1, 0xff000000); Screen.fill(x, y+1, x+1, y+17, 0xff000000);
			Screen.fill(x+16, y+1, x+17, y+17, 0xff000000); Screen.fill(x+1, y+16, x+17, y+17, 0xff000000);
		}
		
	    mc.getItemRenderer().renderItemAndEffectIntoGUI(i, x, y);
	    mc.getItemRenderer().renderItemOverlayIntoGUI(mc.fontRenderer, i, x, y, i.getCount() > 1 ? i.getCount() + "" : "");
		count++;
	}
}
 
Example #16
Source File: RenderUtilImpl.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #17
Source File: Particles_1_12_2.java    From multiconnect with MIT License 5 votes vote down vote up
@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 #18
Source File: DownloadScreen.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
    String right = "Preparing Addon " + addon + " of " + dls.length;
    String right2 = "";
    if (dl.hasStarted()) {
        right = "Downloading Addon " + addon + " of " + dls.length;
        int percent = (int) ((dl.getCurrentSize() * 100) / dl.getTotalSize());
        right2 = percent + "% " + humanReadableByteCount(dl.getCurrentSize()) + "/" + humanReadableByteCount(dl.getTotalSize());
    }
    if (dl.isComplete()) {
        right = "Completed Addon Download " + addon + " of " + dls.length;
        nextAddon();
    }
    fill(0, 0, width, height, RED.getRGB());
    fill(0, height - 20, width, height, DARK.darker().getRGB());
    fill(width - font.getStringWidth(right) - 4, height - 34, width, height, DARK.darker().getRGB());
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.enableAlphaTest();
    minecraft.getTextureManager().bindTexture(new Identifier("sandbox", "textures/gui/sandbox.png"));
    GlStateManager.color4f(1, 1, 1, 1);
    int int_6 = (this.minecraft.getWindow().getScaledWidth() - 256) / 2;
    int int_8 = (this.minecraft.getWindow().getScaledHeight() - 256) / 2;
    this.blit(int_6, int_8, 0, 0, 256, 256);
    GlStateManager.popMatrix();
    drawCenteredString(font, "Connecting to Sandbox", (int) (width / 2f), (int) ((height / 2f) + (width / 3) / 2) - 20, WHITE.getRGB());
    drawRightText(right, width, height - 30, WHITE.getRGB());
    drawCenteredString(font, right2, width - (font.getStringWidth(right) / 2), height - 14, WHITE.getRGB());
    font.drawWithShadow("Joining Private Session", 3, height - 14, WHITE.getRGB());
}
 
Example #19
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void disableAlphaTest() {
    GlStateManager.disableAlphaTest();
}
 
Example #20
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void enableAlphaTest() {
    GlStateManager.enableAlphaTest();
}
 
Example #21
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void disableTexture() {
    GlStateManager.disableTexture();
}
 
Example #22
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void enableTexture() {
    GlStateManager.enableTexture();
}
 
Example #23
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void blendFuncGui() {
    GlStateManager.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
}
 
Example #24
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void shadeModelSmooth() {
    GlStateManager.shadeModel(GL11.GL_SMOOTH);
}
 
Example #25
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void shadeModelFlat() {
    GlStateManager.shadeModel(GL11.GL_FLAT);
}
 
Example #26
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void lineWidth2() {
    GlStateManager.lineWidth(2f);
}
 
Example #27
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void polygonModeLine() {
    GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
}
 
Example #28
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void polygonModeFill() {
    GlStateManager.polygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
}
 
Example #29
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void polygonOffsetMinusOne() {
    GlStateManager.polygonOffset(-1.f, -1.f);
}
 
Example #30
Source File: RenderHelper.java    From BoundingBoxOutlineReloaded with MIT License 4 votes vote down vote up
public static void enablePolygonOffsetLine() {
    GlStateManager.enableLineOffset();
}