1
Support / Issue with Texture.overrideTexelData
« on: January 19, 2021, 02:43:01 am »
Hello,
I'm using the method Texture.overrideTexelData, but it seems that its data is not being used correctly in the texture.
my example below shows the problem with it.
Im using this simples code to change texture data on the fly:
Results:
Original Image:
Drawn Image:
so, it sems that the color params are being swapped when uploading them to the buffer somewhere
I'm using the method Texture.overrideTexelData, but it seems that its data is not being used correctly in the texture.
my example below shows the problem with it.
Im using this simples code to change texture data on the fly:
Code: [Select]
public void update() {
BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR);
int size = w * h * 4;
ByteBuffer buffer = ByteBuffer.allocateDirect(size);
buffer.order(ByteOrder.LITTLE_ENDIAN);
<Draw on Image> -> img.getGraphics().drawImage(spr, 0, 0, null);
DataBuffer dataBuffer = img.getRaster().getDataBuffer();
byte[] pixelData = ((DataBufferByte) dataBuffer).getData();
buffer.put(pixelData);
tex.overrideTexelData(buffer);
}
Results:
Original Image:
Drawn Image:
so, it sems that the color params are being swapped when uploading them to the buffer somewhere