public void setIntensities(float r0, float g0, float b0, float a0,
                             float r1, float g1, float b1, float a1,
                             float r2, float g2, float b2, float a2) {
    // Check if we need alpha or not?
    if ((a0 != 1.0f) || (a1 != 1.0f) || (a2 != 1.0f)) {
      INTERPOLATE_ALPHA = true;
      a_array[0] = (a0 * 253f + 1.0f) * 65536f;
      a_array[1] = (a1 * 253f + 1.0f) * 65536f;
      a_array[2] = (a2 * 253f + 1.0f) * 65536f;
      m_drawFlags|=R_ALPHA;
    } else {
      INTERPOLATE_ALPHA = false;
      m_drawFlags&=~R_ALPHA;
    }

    // Check if we need to interpolate the intensity values
    if ((r0 != r1) || (r1 != r2)) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_GOURAUD;
    } else if ((g0 != g1) || (g1 != g2)) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_GOURAUD;
    } else if ((b0 != b1) || (b1 != b2)) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_GOURAUD;
    } else {
      //m_fill = parent.filli;
      m_drawFlags &=~ R_GOURAUD;
    }

    // push values to arrays.. some extra scaling is added
    // to prevent possible color "overflood" due to rounding errors
    r_array[0] = (r0 * 253f + 1.0f) * 65536f;
    r_array[1] = (r1 * 253f + 1.0f) * 65536f;
    r_array[2] = (r2 * 253f + 1.0f) * 65536f;

    g_array[0] = (g0 * 253f + 1.0f) * 65536f;
    g_array[1] = (g1 * 253f + 1.0f) * 65536f;
    g_array[2] = (g2 * 253f + 1.0f) * 65536f;

    b_array[0] = (b0 * 253f + 1.0f) * 65536f;
    b_array[1] = (b1 * 253f + 1.0f) * 65536f;
    b_array[2] = (b2 * 253f + 1.0f) * 65536f;

    // for plain triangles
    m_fill = 0xFF000000 | 
      ((int)(255*r0) << 16) | ((int)(255*g0) << 8) | (int)(255*b0);
  }