Image.getGraphics() will bind an FBO, i.e. glViewport will be set to that FBO's size. You need to call flush() after calling getGraphics to ensure that the FBO is no longer bound, and that the viewport is reset to the screen's dimensions. That should probably fix your problems with TWL.
In my opinion, getGraphics should ideally just return a value without binding any FBOs. However, because of the way Slick uses FBOs and multiple graphics contexts, this would mean you'd need to do the following:
Code:
g = img.getGraphics();
Graphics.setCurrent(g); //<-- needed to ensure the following line works
myImg.draw(0, 0); //<-- because we aren't using Graphics.drawImage, there is no predraw/postdraw
g.flush(); //<-- flushes/unbinds the FBO
In other words, a
proper fix would lead to a lot of errors. Hopefully when it comes time to a significant Slick refactoring (if that ever happens), we can resolve this so that getGraphics isn't so ugly.
