Before i will post that bug to SDL bug tracker, i want to sum up a bit all the info, and maybe some other developers will say something new or confirm that problem are exist for now, so:
For SDL we have SDL_VIDEORESIZE event, which catch the moment when user trying to resize the window. Usually, code looks like this:
Quote:
while(SDL_PollEvent(&event))
{
switch(event.type)
{
case SDL_VIDEORESIZE:
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_OPENGL|SDL_RESIZABLE);
break;
case SDL_QUIT:
done = 1;
break;
What mean that after we create a first time window by SDL_SetVideoMode, later, by SDL_VIDEORESIZE event, we again call SDL_SetVideoMode, which resize our window.
The problem which i found in our SDL, its that if we have in SetVideoMode , depth more than 0 (16 or 32 for example), OpenGL content just does not updates. But with Depth=0 it updates fine. But that is wrong, because it should updates with any Depth (that logical). So, that is first real bug (imho).
Another one bug or "feature" its that SDL_SetVideoMode always "centered". I.e. on win32/linux, first time called SDL_SetVideoMode are centered, but later all that SDL_SetVideoMode calls over SDL_VIDEORESIZE event are not. Becayse when it centered all the time (as we have on os4 now) then it looks like window "jumping"). So, x1/y1 of window should be on the same place as initialy, and only x2/y2 are changed and data updates to the new positions (without centere the window).
Whyle the first one (about Depth = 0) is real bug, other one (about centered window) maybe possible to disable somehow in the code ?). Very possible that is not bug, but some feature which can be swith on/off by some flags passed to SDL_SetVideoMode fucntion.
For all who in interest,
there is example archive from Hans webpage, where he do resizing with Depth 0, and it works (so, you can see how window jump-centered after resizing). Also you can change Depth 0 to 16/32 and will see how buggy it start to works with not updated OpenGL data.
Compilation are trivial: gcc SDL-GL-basic.c -lSDL -lGL.
Any suggestions, testing and such are wellcome.
Edited by kas1e on 2010/6/3 21:57:19