Convert color to OpenGl Color - Android Graphics

Android examples for Graphics:Color Operation

Description

Convert color to OpenGl Color

Demo Code


import android.graphics.Color;
import android.support.annotation.ColorInt;

public class Main{
    public static float[] toOpenGlColor(@ColorInt int color) {
        return new float[] { Color.red(color) / 255f,
                Color.green(color) / 255f, Color.blue(color) / 255f,
                Color.alpha(color) / 255f };
    }/*from  w w  w.  j  a v  a 2  s  . c om*/
}

Related Tutorials