Hello. I'm trying to copy pixels from OpenGL to WritableImage, code looks good, at least for me.. But results are incorrect, here are image of how it looks (lwjgl window on left side, javafx on right side):
http://s28.postimg.org/4h55qd1bx/Screenshot_from_2015_08_22_15_13_56.pngAnd that rectangle in JavaFX window moves to right, while triangle rotates inside LWJGL window. Result looks completely different than it should be.. This is the code that I use to copy pixels from OpenGL to WritableImage (via PixelWriter):
pixels.clear();
glReadBuffer(GL_FRONT);
glReadPixels(0, 0, 640, 480, GL12.GL_BGRA, GL_UNSIGNED_BYTE, pixels);
pixelWriter.setPixels(0, 0, 640, 480, pixelWriter.getPixelFormat(), pixels, 0);
I tried printing pixelWriter.getPixelFormat(), and this is what I got:
javafx.scene.image.WritablePixelFormat$ByteBgraPre@721e34d8
So as I can see it uses byte type and bgra format, so I get pixels from OpenGL in the same way, but why result is incorrect?