Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
150 user(s) are online (100 user(s) are browsing Forums)

Members: 1
Guests: 149

white, more...

Headlines

 
  Register To Post  

SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event [SOLVED/FIXED]
Home away from home
Home away from home


See User information
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
Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
@kas1e

i'll try to take a look at it asap

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
@kas1e

Fixed in the SVN

http://code.google.com/p/os4sdl/source/detail?r=30

Thank you for the bug report

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Home away from home
Home away from home


See User information
@afxgroup

Way cool ! Thanks a lot !

Btw, you fix only that Depth bug, or also "jumping" one ?

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
@kas1e

both

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Home away from home
Home away from home


See User information
@afxgroup

Tested. 16/32 bit mode work fine (resizing also not jumping). The only problem now with depth = 0, because resizing are jumping. I think you just forget to add cheking on depth 0 , but because Depth=0 are used too from time to time in some SDL prods, imho that also need to add/fix.

But for 16/32 modes all works fine, cool, thanks :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
@kas1e

uhm. that's strange.. i don't see any differences between 0, 16 or 32.. i must investigate..

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
found the guilty. When bpp=0 a new flag is added to current flags: SDL_ANYFORMAT
And so, when you resize the window there is a test that if the flags are changed the window needs to be closed and reopen. I don't thing that is that case. I must see if this can be cured in a clean way

Edit..
Found it..

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Amigans Defender
Amigans Defender


See User information
@kas1e

Ok, try the new version

i'm really tired...
Go to top
Re: SDL/OpenGL bugs in SDL_SetVideoMode with SDL_VIDEORESIZE event.
Home away from home
Home away from home


See User information
@afxgroup
Now all is ok :)

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project