According to docs I’m supposed use SDL_SetVideoMode() again upon
receiving a SDL_VIDEORESIZE. Problem is that this creates another
SDL_VIDEORESIZE, causing an endless resizing loop in certain conditions.
To accomodate for that, I use a delay of 0.5 seconds after the last
SDL_VIDEORESIZE before attempting to SetVideoMode(). Is there any way
more elegant than this?
I’ve never seen this. What values for width and height do you get in the
resize event?
I get the inbetween sizes that were created during resize.
Perhaps I should summarize clearly:
I use a window manager that actually resizes windows during the mouse
dragging instead of drawing a box to indicate new size (it’s sawfish
1.3, but I don’t think that’s of relevance - that is, unless it’s
uncommon to send resize events to application resize requests). This
can obviously create many resize events in very short time.
The SDL program (apart from my own I experienced it with others as well)
uses lots of CPU time and may queue up a few events.
So while resizing from, say, 500x500 to 1000x1000 I could have,
depending on the timing, events for 600x600, 800x800 and 1000x1000 in
the queue by the time I handle it. (The window has reached its final
size of 1000x1000 already.)
I handle 600x600, SetVideoMode() resizes the window back to that,
WM queues new resize event for 600x600, I handle 800x800, WM queues
resize event for 800x800, etc. ad infinitum.
Fast rendering and/or responsive programs won’t exhibit that behaviour.
The problem really is that the only method I can see to react to resize
events actively sets the window size, causing a feedback loop.
My solution is to delay SetVideoMode() until the window size has been
stable for a certain time. It’s not very nice, but it will have to do
if there is no other way.
Besides, does SetVideoMode() destroy OpenGL context for certaing? I.e.
can I expect texture allocations and the like to be all free again?
You should free your GL resources before calling SDL_SetVideoMode() and
reallocate them afterwards. It’s not strictly necessary on Linux, but
doing so keeps things portable. (TODO: keep OpenGL context on Windows)
Ok, thanks.On Sat, Jun 28, 2003 at 09:18:31PM -0700, Sam Lantinga wrote:
–
Andreas Bombe <@Andreas_Bombe> DSA key 0x04880A44