public static void drawGradientRect(int x, int y, int width, int height, int startColor, int endColor) {
float startX = (startColor >> 16 & 255) / 255.0F;
float startY = (startColor >> 8 & 255) / 255.0F;
float startZ = (startColor & 255) / 255.0F;
float startAlpha = (startColor >> 24 & 255) / 255.0F;
float endX = (endColor >> 16 & 255) / 255.0F;
float endY = (endColor >> 8 & 255) / 255.0F;
float endZ = (endColor & 255) / 255.0F;
float endAlpha = (endColor >> 24 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glBegin(GL11.GL_QUADS);
GL11.glColor4f(startX, startY, startZ, startAlpha);
GL11.glVertex2f(x, y);
GL11.glColor4f(startX, startY, startZ, startAlpha);
GL11.glVertex2f(x, y + height);
GL11.glColor4f(endX, endY, endZ, endAlpha);
GL11.glVertex2f(x + width, y + height);
GL11.glColor4f(endX, endY, endZ, endAlpha);
GL11.glVertex2f(x + width, y);
GL11.glEnd();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}