DirectX: Resoution glitch after switching from fullscreen to windowed mode
-
Hey there :) I've got a strange problem... basicly I am writing an .NET (C#) application to render some stuff. By default the rendering works in an panel (Means the device uses the handle of the panel to render stuff there). So now I want to switch to fullscreen mode. Therefor I am creating a window with the size of my test resolution (800x600), release the pointers to the DirectX ressources and reinitialize the device with the window's handle and the fitting presentation parameters (.Windowed = FALSE, .BackBufferWidth/Height = ...). So far so good. It works fine! Now I want to leave fullscreen mode after the user presses the escape key. I am catching the user input and close the window. The OnFormClosing-Event is connected to an method which does the same procedure descriped above in the other direction. It releases the device ressources and the device, reinitializes it with the panel handle and the presentation parameters (.Windowed = TRUE, BackBufferWidth/Height = 0). And this is the problem! I can see the cursor and how it changes if I am moving it around (and about window borders) but the display stays cleared and the resolution does not change. I don't know whats going wrong there, because if I am using Alt+Tab to select my window containing the panel used for rendering and closing the fullscreen window then everything works fine! (And no the problem also isn't the escape-key or the way it gets checked... this part is working, because the FormClosing-event gets fired.) Any ideas what could go wrong? Thanks in advance! :)
-
Hey there :) I've got a strange problem... basicly I am writing an .NET (C#) application to render some stuff. By default the rendering works in an panel (Means the device uses the handle of the panel to render stuff there). So now I want to switch to fullscreen mode. Therefor I am creating a window with the size of my test resolution (800x600), release the pointers to the DirectX ressources and reinitialize the device with the window's handle and the fitting presentation parameters (.Windowed = FALSE, .BackBufferWidth/Height = ...). So far so good. It works fine! Now I want to leave fullscreen mode after the user presses the escape key. I am catching the user input and close the window. The OnFormClosing-Event is connected to an method which does the same procedure descriped above in the other direction. It releases the device ressources and the device, reinitializes it with the panel handle and the presentation parameters (.Windowed = TRUE, BackBufferWidth/Height = 0). And this is the problem! I can see the cursor and how it changes if I am moving it around (and about window borders) but the display stays cleared and the resolution does not change. I don't know whats going wrong there, because if I am using Alt+Tab to select my window containing the panel used for rendering and closing the fullscreen window then everything works fine! (And no the problem also isn't the escape-key or the way it gets checked... this part is working, because the FormClosing-event gets fired.) Any ideas what could go wrong? Thanks in advance! :)
Aschratt wrote:
Any ideas what could go wrong?
No. It sounds too complex for me, why don't you use a Panel in full size too? Just make your window full size, and fill it with the Panel, possibly by setting panel.Dock=DockStyle.Fill? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
-
Aschratt wrote:
Any ideas what could go wrong?
No. It sounds too complex for me, why don't you use a Panel in full size too? Just make your window full size, and fill it with the Panel, possibly by setting panel.Dock=DockStyle.Fill? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
Because there are other controls on this formular ;) The fullscreen mode should be simply used for "viewing" (and only for viewing). The windowed mode should be some kind of editor. Anyway I do have to reinitialize the device after switching back from fullscreen mode (since this is set using the presentation parameters). And so this should not solve my problem, I guess... :( Thanks anyway so far :)
-
Because there are other controls on this formular ;) The fullscreen mode should be simply used for "viewing" (and only for viewing). The windowed mode should be some kind of editor. Anyway I do have to reinitialize the device after switching back from fullscreen mode (since this is set using the presentation parameters). And so this should not solve my problem, I guess... :( Thanks anyway so far :)
Allright... problem solved. I simply forgot to release all references to the device :) Thanks anyway!