A better way of not using reflection would be:
/**
* @param color1 color in hex.
* @param color2 color in hex.
*/
function drawSimpleVerticalGradientRect(x, y, x2, y2, color1, color2) {
GL11.glBegin(GL11.GL_QUADS);
glColor(color1);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x, y2);
glColor(color2);
GL11.glVertex2d(x2, y2);
GL11.glVertex2d(x2, y);
GL11.glEnd();
}
/**
* @param color A color in hex.
*/
function glColor(color) {
var a = (color >> 24) & 0xFF;
var r = (color >> 16) & 0xFF;
var g = (color >> 8) & 0xFF;
var b = (color) & 0xFF;
GL11.glColor4f(r / 255, g / 255, b / 255, a / 255);
}
I would like to explain this, but i don't know if i could do it well
Example Usage:
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Tells GL to transition between colors
GlStateManager.shadeModel(GL11.GL_SMOOTH);
drawSimpleVerticalGradientRect(10, 10, 390, 390, 0xffffffff, 0x00ffffff);
// Tells GL to use the ONLY' last color
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.disableBlend();