Java Code Examples for net.minecraft.client.renderer.GlStateManager#colorMask()

The following examples show how to use net.minecraft.client.renderer.GlStateManager#colorMask() . 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: GuiDownloadTofuTerrain.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GlStateManager.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    GlStateManager.colorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    GlStateManager.disableAlpha();
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        float f = 1.0F / (i + 1);
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        buffer.pos(j, k, 0.0D).tex(0.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(j, 0.0D, 0.0D).tex(1.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, 0.0D, 0.0D).tex(1.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
        buffer.pos(0.0D, k, 0.0D).tex(0.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
    }

    tessellator.draw();
    GlStateManager.enableAlpha();
    GlStateManager.colorMask(true, true, true, true);
}
 
Example 2
Source File: Widget.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
protected static void drawSelectionOverlay(int x, int y, int width, int height) {
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    drawGradientRect(x, y, width, height, -2130706433, -2130706433);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableDepth();
    GlStateManager.enableBlend();
}
 
Example 3
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void renderSlotOverlay(Slot slot) {
    GlStateManager.disableDepth();
    int slotX = slot.xPos;
    int slotY = slot.yPos;
    GlStateManager.colorMask(true, true, true, false);
    drawGradientRect(slotX, slotY, slotX + 16, slotY + 16, -2130706433, -2130706433);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableDepth();
    GlStateManager.enableBlend();
}
 
Example 4
Source File: FireRecipeJEI.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
	WizardryJEIPlugin.fireCategory.flame.draw(minecraft, 30, 14);
	if (mouseX >= 30 && mouseX <= 30 + 16
			&& mouseY >= 14 && mouseY <= 14 + 16) {
		GlStateManager.disableLighting();
		GlStateManager.disableDepth();
		GlStateManager.colorMask(true, true, true, false);
		drawGradientRect(30, 14, 30 + 16, 14 + 16);
		GlStateManager.colorMask(true, true, true, true);
		GlStateManager.enableLighting();
		GlStateManager.enableDepth();
	}
}
 
Example 5
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 5 votes vote down vote up
private void rotateAndBlurSkybox(float p_73968_1_)
{
	this.mc.getTextureManager().bindTexture(this.field_110351_G);
	GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
	GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
	GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
	GlStateManager.enableBlend();
	GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
	GlStateManager.colorMask(true, true, true, false);
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexBuffer = tessellator.getBuffer();
	vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
	GlStateManager.disableAlpha();
	int i = 3;

	if (guiConfig.panorama.blur)
	{
		for (int j = 0; j < i; ++j)
		{
			float f = 1.0F / (float) (j + 1);
			int k = this.width;
			int l = this.height;
			float f1 = (float) (j - i / 2) / 256.0F;
			vertexBuffer.pos((double) k, (double) l, (double) this.zLevel).tex((double) (0.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos((double) k, 0.0D, (double) this.zLevel).tex((double) (1.0F + f1), 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos(0.0D, 0.0D, (double) this.zLevel).tex((double) (1.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
			vertexBuffer.pos(0.0D, (double) l, (double) this.zLevel).tex((double) (0.0F + f1), 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex();
		}
	}

	tessellator.draw();
	GlStateManager.enableAlpha();
	GlStateManager.colorMask(true, true, true, true);
}
 
Example 6
Source File: GuiDownloadTofuTerrain.java    From TofuCraftReload with MIT License 4 votes vote down vote up
private void drawPanorama(float ticks) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.pushMatrix();
    GlStateManager.loadIdentity();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
    GlStateManager.enableBlend();
    GlStateManager.disableAlpha();
    GlStateManager.disableCull();
    GlStateManager.depthMask(false);
    GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
    byte b0 = 8;

    for (int k = 0; k < b0 * b0; ++k) {
        GlStateManager.pushMatrix();
        float f1 = ((float) (k % b0) / (float) b0 - 0.5F) / 64.0F;
        float f2 = ((float) (k / b0) / (float) b0 - 0.5F) / 64.0F;
        float f3 = 0.0F;
        GlStateManager.translate(f1, f2, f3);
        GlStateManager.rotate(MathHelper.sin((panoramaTimer + ticks) / 400.0F) * 15.0F + 10.0F, 1.0F, 0.0F, 0.0F);
        GlStateManager.rotate(-(panoramaTimer + ticks) * 0.08F, 0.0F, 1.0F, 0.0F);

        for (int l = 0; l < 6; ++l) {
            GlStateManager.pushMatrix();

            switch (l) {
                case 1:
                    GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 2:
                    GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 3:
                    GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
                    break;
                case 4:
                    GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
                    break;
                case 5:
                    GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
                    break;
            }

            mc.getTextureManager().bindTexture(getPanoramaPaths().getPath(l));
            buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
            int i = 255 / (k + 1);
            buffer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, i).endVertex();
            buffer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, i).endVertex();
            tessellator.draw();
            GlStateManager.popMatrix();
        }

        GlStateManager.popMatrix();
        GlStateManager.colorMask(true, true, true, false);
    }

    buffer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.matrixMode(GL11.GL_PROJECTION);
    GlStateManager.popMatrix();
    GlStateManager.matrixMode(GL11.GL_MODELVIEW);
    GlStateManager.popMatrix();
    GlStateManager.depthMask(true);
    GlStateManager.enableCull();
    GlStateManager.enableDepth();
}
 
Example 7
Source File: WrapperGlStateManager.java    From ClientBase with MIT License 4 votes vote down vote up
public static void colorMask(boolean var0, boolean var1, boolean var2, boolean var3) {
    GlStateManager.colorMask(var0, var1, var2, var3);
}
 
Example 8
Source File: ShulkerViewer.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  final int DEPTH = 500;
  
  int x = posX;
  int y = posY;
  
  GlStateManager.enableTexture2D();
  GlStateManager.disableLighting();
  GlStateManager.color(
      1.f,
      1.f,
      1.f,
      !isLocked()
          ? (tooltip_opacity.getAsFloat() / 255.f)
          : (locked_opacity.getAsFloat() / 255.f));
  
  GlStateManager.enableBlend();
  GlStateManager.tryBlendFuncSeparate(
      GlStateManager.SourceFactor.SRC_ALPHA,
      GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
      GlStateManager.SourceFactor.ONE,
      GlStateManager.DestFactor.ZERO);
  
  MC.getTextureManager().bindTexture(SHULKER_GUI_TEXTURE);
  
  // width 176        = width of container
  // height 16        = top of the gui
  // height 54        = gui item boxes
  // height 6         = bottom of the gui
  SurfaceHelper.drawTexturedRect(x, y, 0, 0, 176, 16, DEPTH);
  SurfaceHelper.drawTexturedRect(x, y + 16, 0, 16, 176, 54, DEPTH);
  SurfaceHelper.drawTexturedRect(x, y + 16 + 54, 0, 160, 176, 6, DEPTH);
  
  GlStateManager.disableDepth();
  SurfaceHelper.drawText(parentShulker.getDisplayName(), x + 8, y + 6, Colors.BLACK.toBuffer());
  GlStateManager.enableDepth();
  
  RenderHelper.enableGUIStandardItemLighting();
  GlStateManager.enableRescaleNormal();
  GlStateManager.enableColorMaterial();
  GlStateManager.enableLighting();
  
  Slot hoveringOver = null;
  
  int rx = x + 8;
  int ry = y - 1;
  
  for (Slot slot : inventorySlots.inventorySlots) {
    if (slot.getHasStack()) {
      int px = rx + slot.xPos;
      int py = ry + slot.yPos;
      MC.getRenderItem().zLevel = DEPTH + 1;
      SurfaceHelper.drawItem(slot.getStack(), px, py);
      SurfaceHelper.drawItemOverlay(slot.getStack(), px, py);
      MC.getRenderItem().zLevel = 0.f;
      if (isPointInRegion(px, py, 16, 16, mouseX, mouseY)) {
        hoveringOver = slot;
      }
    }
  }
  
  GlStateManager.disableLighting();
  
  if (hoveringOver != null) {
    // background of the gui
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    this.drawGradientRect(
        rx + hoveringOver.xPos,
        ry + hoveringOver.yPos,
        rx + hoveringOver.xPos + 16,
        ry + hoveringOver.yPos + 16,
        -2130706433,
        -2130706433);
    GlStateManager.colorMask(true, true, true, true);
    
    // tool tip
    GlStateManager.color(1.f, 1.f, 1.f, 1.0f);
    GlStateManager.pushMatrix();
    isModGeneratedToolTip = true;
    renderToolTip(hoveringOver.getStack(), mouseX + 8, mouseY + 8);
    isModGeneratedToolTip = false;
    GlStateManager.popMatrix();
    GlStateManager.enableDepth();
  }
  
  if (isPointInRegion(this.posX, this.posY, getWidth(), getHeight(), mouseX, mouseY)) {
    isMouseInShulkerGui = true;
  }
  
  GlStateManager.disableBlend();
  GlStateManager.color(1.f, 1.f, 1.f, 1.0f);
}
 
Example 9
Source File: GuiCustom.java    From Custom-Main-Menu with MIT License 4 votes vote down vote up
private void drawPanorama(int p_73970_1_, int p_73970_2_, float p_73970_3_)
{
	Tessellator tessellator = Tessellator.getInstance();
	BufferBuilder vertexBuffer = tessellator.getBuffer();
	GlStateManager.matrixMode(5889);
	GlStateManager.pushMatrix();
	GlStateManager.loadIdentity();
	Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
	GlStateManager.matrixMode(5888);
	GlStateManager.pushMatrix();
	GlStateManager.loadIdentity();
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
	GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.enableBlend();
	GlStateManager.disableAlpha();
	GlStateManager.disableCull();
	GlStateManager.depthMask(false);
	GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
	int i = 8;

	for (int j = 0; j < 64; ++j)
	{
		GlStateManager.pushMatrix();
		float f = ((float) (j % i) / (float) i - 0.5F) / 64.0F;
		float f1 = ((float) (j / i) / (float) i - 0.5F) / 64.0F;
		float f2 = 0.0F;
		GlStateManager.translate(f, f1, 0.0F);
		GlStateManager.rotate(MathHelper.sin(this.panoramaTimer / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F);
		GlStateManager.rotate(-this.panoramaTimer * 0.1F, 0.0F, 1.0F, 0.0F);

		for (int k = 0; k < 6; ++k)
		{
			GlStateManager.pushMatrix();

			if (k == 1)
			{
				GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F);
			}

			if (k == 2)
			{
				GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
			}

			if (k == 3)
			{
				GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
			}

			if (k == 4)
			{
				GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
			}

			if (k == 5)
			{
				GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
			}

			titlePanoramaPaths[k].bind();
			vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
			int l = 255 / (j + 1);
			float f3 = 0.0F;
			vertexBuffer.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, l).endVertex();
			vertexBuffer.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, l).endVertex();
			tessellator.draw();
			GlStateManager.popMatrix();
		}

		GlStateManager.popMatrix();
		GlStateManager.colorMask(true, true, true, false);
	}

	vertexBuffer.setTranslation(0.0D, 0.0D, 0.0D);
	GlStateManager.colorMask(true, true, true, true);
	GlStateManager.matrixMode(5889);
	GlStateManager.popMatrix();
	GlStateManager.matrixMode(5888);
	GlStateManager.popMatrix();
	GlStateManager.depthMask(true);
	GlStateManager.enableCull();
	GlStateManager.enableDepth();
}