Problem with switching display modes [LWJGL / OpenGL]

Accname

2D-Graphics enthusiast
Reaction score
1,462
Hi, i am still working with java and lwjgl to build up a little game using OpenGL for graphics.
I wanted to give the user the possibility to change the resolution in game, like many good games have.
He can also choose whether to play in fullscreen or not.
Now the system itself *works*. I can switch between fullscreen or not, and i can set any resolution i want.
But there are a few side effects.

For example, when you are in fullscreen and then change the resolution nothing will be drawn on screen anymore until you tab out and back in.
Also, sometimes it doesnt go into fullscreen mode for some reason. The screen flashes white for a split second (you barely notice) and the application is still in window mode.
But when you try again it works.
No exception is thrown though.
Another thing is, when you switch between fullscreen and window mode all keys you have currently pressed will be kept pressed until you press/release them again. This is quite obnoxious.

Does anybody have an idea how i could fix those issues? Some kind of 'clear' method i need to call after switching resolution and fullscreen mode?
Thank you for the help.

Update:
I was able to hotfix most of the problems. When fullscreen is enabled and resolution is changed i first switch into windowed mode with set resolution and then into fullscreen.
But still there is the bug with the keys not being released when fullscreen/resolution are being changed.

Update 2:
Found the problem with the input. As it seems when resizing the window, or switching between fullscreen or not, keyboard events might get missed.
I needed to flush my internal key-state observer class after a resize.

This can be closed now i guess, sorry guys for the thread, all problems have been solved as it seems.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top