Screenshots only showing background

I'm having an issue creating screenshots from my simple game.



I'm using StandardGame and DebugGameState - all i do is add a box and take a screenshot…



what i get is an image that's just a fill of the background colour - i don't see the box or the text on the screen.



Before i post any details i'm just wondering if there's something obvious i'm missing here when taking screen shots either in StandardGame or just generally.



T

I'm new to JME so I'm not really sure why it works the way it does, but have you tried clearing the buffers first as mentioned on this page: http://www.jmonkeyengine.com/wiki/doku.php?id=renderer ?



If not, here's what's worked for me in SimpleGame



display.getRenderer().clearBuffers();
display.getRenderer().draw(rootNode);
display.getRenderer().takeScreenShot("test1");



According to the link I've posted above, there should be a call to display.getRenderer().displayBackBuffer() in between draw() and takeScreenShot(), but I've found that it will only display the background. The following is just conjecture based on what I've seen. I believe this is due to an inconsistency between the documentation for clearBuffers() for the Renderer class, and how JOGLRenderer and LWGLRenderer implement the method, since the implementation does not appear to clear the back buffer. It also appears that draw() will draw immediately to the current buffer (at least if it's cleared). So calling displayBackBuffer() swaps the newly drawn scene with the old blank background, and calling it again will bring the scene back to the current buffer.

PS, depending on what you're doing you may need to call rootNode.updateGeometricState() and rootNode.updateRenderState() before you try rendering, and even if you don't need to it can't hurt (at least, I don't think it can  :| ).

Thanks SwitchShift - that got it working… when i get the time i'll take a closer look at the rendering pipeline to see what's going on there, but i'm new to jmonkey, too, and just want to get a POC up and running right now…



thanks again for your help!