Recreating the display

Started by EricTheRed, February 04, 2004, 02:20:50

Previous topic - Next topic

EricTheRed

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...)

elias

No. You have to destroy them before you destroy the window. And then re-create them again after the window has been created.

- elias

princec

...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 :)

cfmdobbie

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...
ellomynameis Charlie Dobbie.

Mojomonkey

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?
ever send a man to do a monkey's work.

princec

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 :)

elias

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

elias

And regarding the independent devices: Are they independent in win32 at all? I thought DirectInput needed a hwnd to operate.

- elias

princec

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 :)

elias

No thanks, that sounds like too much trouble for little gain. Besides, that will probably screw native cursor mode.

EricTheRed

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.)

princec

Well, however we implement it, it'll recreate your devices, yes.

Cas :)