So it seems that in the first code the screenshot is made to late, when screen and Backgroundcolor have already changed back to A and black.
What can I do to prevent this?
(I’m using jMonkeyEngine SDK v3.5.2-stable )
I dont’t know if it matters but the initialisation looks like this
I think you might be able to use the Application Enqueue method here. I did not test this theory but essentially it would delay the transition to the next frame. Like so:
I assume the code is executed in the render loop. So what ever you do there, will be executed in a single frame. That is why you can’t capture the screen transition. And the screenshot is probably taken after the frame is rendered.
Application Enqueue method will add your stuff to a queue, the queue is then processed on the next frame. You can even nest them to create deeper frame actions (why would you though…).
Primarily the said method is used to make changes outside the render loop. From different threads etc you can delegate stuff to happen on the render loop. Modifying (also reading it is not consistent) scene outside the render loop is forbidden, hence the delegate.