buff=image;
Raster r = buff.getRaster();
int[] img = null;
img = r.getPixels(0, 0, buff.getWidth(), buff.getHeight(), img);
texture = ByteBuffer.allocateDirect(buff.getWidth() * buff.getHeight() * 3);
for (int y = 0; y < buff.getHeight(); y++){
for (int x = 0; x < buff.getWidth(); x++) {
texture.put((byte) img[(y * buff.getWidth() + x) * 3]);
texture.put((byte) img[(y * buff.getWidth() + x) * 3 + 1]);//hier
texture.put((byte) img[(y * buff.getWidth() + x) * 3 + 2]);
}
}
tWidth = buff.getWidth();
tHeight = buff.getHeight();