Example #1
0
 private void createCheckerTexture(final ReadableColor a, final ReadableColor b, final int size) {
   int i = 0;
   for (int y = 0; y < HEIGHT; y++) {
     for (int x = 0; x < WIDTH; x++) {
       ReadableColor c =
           (x / size) % 2 == 0 ? ((y / size) % 2 == 0 ? a : b) : ((y / size) % 2 == 0 ? b : a);
       texture.put(i + 0, c.getRedByte());
       texture.put(i + 1, c.getGreenByte());
       texture.put(i + 2, c.getBlueByte());
       i += 3;
     }
   }
 }
Example #2
0
 private void createGradientTexture(final ReadableColor a, final ReadableColor b) {
   float l = 0.0f;
   int i = 0;
   for (int y = 0; y < HEIGHT; y++) {
     for (int x = 0; x < WIDTH; x++) {
       texture.put(i + 0, lerp(a.getRed(), b.getRed(), l));
       texture.put(i + 1, lerp(a.getGreen(), b.getGreen(), l));
       texture.put(i + 2, lerp(a.getBlue(), b.getBlue(), l));
       i += 3;
     }
     l += (1.0f / (HEIGHT - 1));
   }
 }