Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Oct 2009
Offline Last Active Jul 12 2016 02:09 PM

Posts I've Made

In Topic: WinAPI + OpenGL: Change window style and/or resolution

04 June 2016 - 01:04 PM

I've made a small test program in a single cpp file. I've sent the binary to one of my friend and it works as expected. So it seems the problem is with my computer. :)

Can it be a driver bug? If so where should I ask/report the bug? Btw, I have a Radeon HD 6670.


In Topic: WinAPI + OpenGL: Change window style and/or resolution

04 June 2016 - 01:37 AM

Is that FRAPS display always active?  If so, try disabling it.. it probably overrides a bunch of GL calls to put its overlay there.


No, it isn't, just turned on to check if I have an FPS counter at all.


The strange thing is if I set the SWP_NOSIZE flag, everything works fine... except that the client area won't be 1280x720 but 1296x758, because the width and height parameters are ignored. So if the client area is changed, the problem disappers.


Probably I'll end up using 2 window mode, Windowed and Borderless, where Borderless will be the Fullscreen. :) It will have the same size as the monitor's resolution. The current Fullscreen mode won't be used because it's used with ChangeDisplayMode and that can rearrange icons on the desktop and resize other windows if alt-tabbed and the user won't be happy. :)

In Topic: WinAPI + OpenGL: Change window style and/or resolution

03 June 2016 - 01:40 PM

From your images it seems clear that the OpenGL part stays right where it was in respect to the top-left corner of the window (not the just the client-area).. whereas I guess the top left part that was the border before gets the background-color..

Exactly! And my FRAPS displays fps at the bottom-right corner and after the style change, the fps counter is invisible, because it's "outside" of the window. It's like the contexts are not updated properly here.


Unfortunately nothing helps :(

In Topic: WinAPI + OpenGL: Change window style and/or resolution

03 June 2016 - 10:25 AM

Thanks for the tests!


Hm, it's strange that it works for you. I get a little "un-updated" area at the top of the window, when changing to borderless mode.



I have a more flexible setup for styles, so I'm not using nor overlapped nor thickframe directly. And also I don't let the user to resize the window by hand. So those styles are not set.



Hm, I'll probably change my code to the save/restore version, but I'm not sure if the current solution is wrong. First, I remove the fullscreen bits THEN add the windowed bits, so if the bits overlap, it's not a problem, because the correct bits will be set at the end. Also, the windowed style is not changed at run-time, it's defined only once, when the window is created.


Well... some players like to have a non-fullscreen window without borders and stuffs. I don't know why. If I can't get it working I won't let the user have a borderless window with smaller size than the monitor's resolution. :/

In Topic: WinAPI + OpenGL: Change window style and/or resolution

03 June 2016 - 03:15 AM

Thanks for your replies!


Using xor does not solve my problem unfortunately. :(

BTW, don't you have to set the SWP_FRAMECHANGED flag to the SetWindowPos function?


I don't understand this whole process. I mean, if I change the size/resolution as well, everything works.

And also, if I start the application with a Windowed (WS_CAPTION, WS_BORDER, etc.) window, then switch to Borderless (WS_POPUP) mode, a WM_SIZE message is not sent. However, if I switch back to Windowed then to Borderless again, two WM_SIZE is sent, first with 1296x758 then with 1280x720.


"Stranger things have happened"


Attached a simple test program (does nothing just clears the window with a red color). You can switch between windowed and borderless mode with F1 and F2 keys. Don't worry it's not a virus. :)

Attached File  WindowStyleChange.zip   304.01KB   12 downloads

If you check the red area of the windowed mode and the full area of the borderless (not-looking-properly) window, it's the same (1280x720) and this is what I want.