/** * Copy ARGB pixels to a ByteBuffer without changing the ARGB byte order. If used to make a * texture, the pixel format is GL12.GL_BGRA. With this format we can leave pixels in ARGB order * (faster), but unfortunately I had problems building mipmaps in BGRA format * (GLU.gluBuild2DMipmaps() did not recognize GL_UNSIGNED_INT_8_8_8_8 and * GL_UNSIGNED_INT_8_8_8_8_REV types so screwed up the BGRA/ARGB byte order on Mac). * * @return ByteBuffer */ public static ByteBuffer convertImagePixelsARGB( int[] jpixels, int imgw, int imgh, boolean flipVertically) { // flip Y axis if (flipVertically) { jpixels = flipPixels(jpixels, imgw, imgh); // flip Y axis } // put int pixels into Byte Buffer ByteBuffer bb = GLApp.allocBytes(jpixels.length * 4); // 4 bytes per pixel bb.asIntBuffer().put(jpixels); return bb; }