Exemplo n.º 1
0
 public static void drawGradientRectangle(
     int x, int y, int gradientX, int gradientY, int colorOne, int colorTwo) {
   float alphaOne = (float) (colorOne >> 24 & 255) / 255.0F;
   float redOne = (float) (colorOne >> 16 & 255) / 255.0F;
   float greenOne = (float) (colorOne >> 8 & 255) / 255.0F;
   float blueOne = (float) (colorOne & 255) / 255.0F;
   float alphaTwo = (float) (colorTwo >> 24 & 255) / 255.0F;
   float redTwo = (float) (colorTwo >> 16 & 255) / 255.0F;
   float greenTwo = (float) (colorTwo >> 8 & 255) / 255.0F;
   float blueTwo = (float) (colorTwo & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(770, 771);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   MinecraftTessellator tessellator = Spoutcraft.getTessellator();
   tessellator.startDrawingQuads();
   tessellator.setColorRGBAFloat(redOne, greenOne, blueOne, alphaOne);
   tessellator.addVertex((double) gradientX, (double) y, 0.0D);
   tessellator.addVertex((double) x, (double) y, 0.0D);
   tessellator.setColorRGBAFloat(redTwo, greenTwo, blueTwo, alphaTwo);
   tessellator.addVertex((double) x, (double) gradientY, 0.0D);
   tessellator.addVertex((double) gradientX, (double) gradientY, 0.0D);
   tessellator.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Exemplo n.º 2
0
  public static void drawRectangle(int x, int y, int width, int height, int color) {
    int temp;
    if (x < width) {
      temp = x;
      x = width;
      width = temp;
    }

    if (y < height) {
      temp = y;
      y = height;
      height = temp;
    }

    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(red, green, blue, alpha);
    MinecraftTessellator tessellator = Spoutcraft.getTessellator();
    tessellator.startDrawingQuads();
    tessellator.addVertex((double) x, (double) height, 0.0D);
    tessellator.addVertex((double) width, (double) height, 0.0D);
    tessellator.addVertex((double) width, (double) y, 0.0D);
    tessellator.addVertex((double) x, (double) y, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
  }