Window recreation

Now that we have the new LWJGL .92, I’d like us to support changing resolutions and windowed/full screen during program run. I looked into doing so for Dirt (if you’ve run Dirt .2 you know you can alter the resolution but you needed to restart to activate it.)



Changes required:

It’s pretty simple, just add a recreate method to DisplaySystem and Renderer (and their implementing classes) The recreate method will reuse the existing object and simply update the necessary fields and so forth. It’s very simple, so I’ve taken the liberty to implement this in my local jME to see how it will run with Dirt and except for some GUI scaling issues, it works quite well.

sounds good to me.

I like the idea but I think that the name recreate sounds misleading. It makes it sound like I would have to reload all the textures and other objects. I think that the name resize sounds better.

But you are doing more than just resizing, correct? You can change the color depth, the width, the height, the depth bits, the stencil bits, etc.



You are recreating the window, more than just resizing it.

Then I guess resize is a bad name. But I still do not like the name recreate, do to the fact that in Directx they use a simuler name that means you have to reload the textures.The name recreateWindow sounds good.

It’s up to Mojo on final naming… But the method is already called recreateWindow, my original post wasn’t too clear on that, sorry.

recreateWindow is fine with me.

Great, almost done with this and a Test class. One other thing while I’m in here… Why are bpp, freq and fullscreen variables in LWJGLDisplaySystem rather than being in DisplaySystem like height and width? If no special reason, can I move them up and add accessor methods for them?

Early oversight. They can be moved up.

Ok, changes done and checked in. A new Test class called TestRecreateWindow was added as well. I wanted to base it off of TestSphere which was never updated to the new SimpleGame stuff so I took the time to update that class as well.



Test controls are normal with the addition of:

f - toggle full screen

r - rotate between resolutions (640x480, 800x600, 1024x768)



PS: In running the test, I’ve found one odd thing which I think is an opengl driver or lwjgl issue… If I start up the test in 16 bit mode, windowed, and then change to full screen, things go a bit wacky. Every other combination seems to work fine for me.