LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: EricTheRed on February 04, 2004, 02:20:50

Title: Recreating the display
Post by: EricTheRed on February 04, 2004, 02:20:50
Quick question:
Say I create the display, and create the Mouse and Keyboard along with it. If I now go and destroy the display and recreate it, say, in windowed mode, am I obligated to also destroy and recreate the Mouse and Keyboard? That is, will they continue to work if simply ignore them?

Thanks. (Hope this isn't an obvious question answered somewhere in the docs...)
Title: Recreating the display
Post by: elias on February 05, 2004, 10:00:39
No. You have to destroy them before you destroy the window. And then re-create them again after the window has been created.

- elias
Title: Recreating the display
Post by: princec on February 05, 2004, 11:13:11
...something I think we ought to fix in 0.9. Is it possible to make them independent of the Window on Linux and MacOSX?


Cas :)
Title: Recreating the display
Post by: cfmdobbie on February 05, 2004, 12:26:22
Sounds like a good feature - if there's a problem with keeping them over a window rebuild, can this be hidden in the API?

If you can recreate any created input devices transparently in Window.create() on platforms that require it, that would be great.  Could lead to a particular exception only being thrown on particular platforms though...
Title: Recreating the display
Post by: Mojomonkey on February 05, 2004, 13:57:09
I notice that when you reinit you have to destroy the GL context, meaning you lose texture bindings, lists, etc. Would it be possible to ever change resolutions, fullscreen without destroying GL?
Title: Recreating the display
Post by: princec on February 05, 2004, 15:19:32
We should make that possible, yes. The real issue is that we need to make Window track display mode changes when in fullscreen mode.

Cas :)
Title: Recreating the display
Post by: elias on February 05, 2004, 15:58:42
Are we sure we want to do this? I heard JOGL had a lot of problems with resizing windows. It might relate to problems of reassigning the context to a different window (with a potentially different pixel format).

- elias
Title: Recreating the display
Post by: elias on February 05, 2004, 15:59:44
And regarding the independent devices: Are they independent in win32 at all? I thought DirectInput needed a hwnd to operate.

- elias
Title: Recreating the display
Post by: princec on February 05, 2004, 20:39:30
I heard that JInput uses a simple invisible window, and runs DirectInput through that, rather than through the actual game window. Seems like a perfectly reasonable way to do it - but what about the other OS's?

Cas :)
Title: Recreating the display
Post by: elias on February 05, 2004, 20:55:22
No thanks, that sounds like too much trouble for little gain. Besides, that will probably screw native cursor mode.
Title: Recreating the display
Post by: EricTheRed on February 05, 2004, 22:50:19
Thanks for the comprehensive answer.

I'd appreciate it if the Window transparently recreates any previously created input devices - it would certainly clean up my code a bit. I'd also like to be able to resize the display/toggle fullscreen without being forced to reinitialize the GL context. (I could see this being very useful for in-game options screens.)
Title: Recreating the display
Post by: princec on February 06, 2004, 09:55:46
Well, however we implement it, it'll recreate your devices, yes.

Cas :)