Bug: resizing windowed opengl video surface: event.resize.w has an overflow (win32)

dear devlprs,

  1. the latest 1.2.10 release still has a resize bug under win32 opengl
    windowed, doublebufferd mode!
    if i make a resizable window, and resize it, the event structure gets
    NOT filled correctly! the event.resize.h field works fine, displays the
    new size. but in the event.resize.w field is an overflow:

“trying to resize to: 54985690x734 resize failed! error:”

SDL_GetError also does not produce some error message why that failed

// my initialisation:
videoFlags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE;
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
surface = SDL_SetVideoMode( _w, _h, bits_per_pixel, videoFlags );
if ( !surface )
{
std::cerr << “Video mode set failed:” << SDL_GetError();
SDL_Quit();
exit(1);
}

case SDL_VIDEORESIZE:
cout << "\ntrying to resize to: " << event.resize.w << “x” <<
event.resize.h;

_check = SDL_VideoModeOK(event.resize.w, event.resize.h, _bpp, videoFlags);

if(_check)
{
surface = SDL_SetVideoMode( event.resize.w, event.resize.h, _bpp,
videoFlags );
if (surface)
{
_valid=false; // resize successful, so opengl needs to get reinitialized
_w=event.resize.w;
_h=event.resize.h;
}
else
{
std::cerr << "\nCould not get a surface after resize: " << SDL_GetError();
SDL_Quit();
exit(1);
}
}
else
{
std::cerr << “resize failed! error:” << SDL_GetError();
}

  1. there is another very annoying thing: if i restart my application,
    the window gets created every time on a new position on the screen. and
    that position shifts each time more downwards to the lower right corner
    of the screen, till finally the window is party occluded by the task bar
    (remember im talking about win32 environment) why simply center the
    window on the screen? where does this shift come from?

Andre Krause wrote:

dear devlprs,

  1. the latest 1.2.10 release still has a resize bug under win32 opengl
    windowed, doublebufferd mode!
    if i make a resizable window, and resize it, the event structure gets
    NOT filled correctly! the event.resize.h field works fine, displays the
    new size. but in the event.resize.w field is an overflow:

“trying to resize to: 54985690x734 resize failed! error:”

… snip …

  1. there is another very annoying thing: if i restart my application,
    the window gets created every time on a new position on the screen. and
    that position shifts each time more downwards to the lower right corner
    of the screen, till finally the window is party occluded by the task bar
    (remember im talking about win32 environment) why simply center the
    window on the screen? where does this shift come from?

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

sorry for point 2.
i found out that it is indeed possible to center the window or even to
specify the x,y positions by using the environment vars
SDL_VIDEO_WINDOW_POS or SDL_VIDEO_CENTERED.
maybe a little notice in the documentation of SDL_SetVideoMode would
have avoided my question :slight_smile:

but the resize bug is still open. any ideas? in the meanwhile, i’ll try
to debug a littlebit, maybe i can find the bug by myself.

SDL_GL_DOUBLEBUFFER is not a SDL_SetVideoMode() flag. OpenGL
doublebuffering is specified exclusively by the SDL_GL_SetAttribute()
function (as you also do correctly).

The value of SDL_GL_DOUBLEBUFFER is 5, meaning that passing it as a
SDL_SetVideoMode() flag is the same as passing the flags SDL_HWSURFACE
(1) and SDL_ASYNCBLIT (2).
I don’t know whether that is the cause of your problem though, I would
assume those flags are ignored when using OpenGL. :)On 5/20/06, Andre Krause wrote:

// my initialisation:
videoFlags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE;


Regards,
Rasmus Neckelmann

Andre Krause wrote:

dear devlprs,

  1. the latest 1.2.10 release still has a resize bug under win32 opengl
    windowed, doublebufferd mode!
    if i make a resizable window, and resize it, the event structure gets
    NOT filled correctly! the event.resize.h field works fine, displays the
    new size. but in the event.resize.w field is an overflow:

“trying to resize to: 54985690x734 resize failed! error:”

… snip …

  1. there is another very annoying thing: if i restart my application,
    the window gets created every time on a new position on the screen. and
    that position shifts each time more downwards to the lower right corner
    of the screen, till finally the window is party occluded by the task bar
    (remember im talking about win32 environment) why simply center the
    window on the screen? where does this shift come from?

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

sorry for point 2.
i found out that it is indeed possible to center the window or even to
specify the x,y positions by using the environment vars
SDL_VIDEO_WINDOW_POS or SDL_VIDEO_CENTERED.
maybe a little notice in the documentation of SDL_SetVideoMode would
have avoided my question :slight_smile:

The documentation is in a wiki. If it needs to be corrected, please,
correct it.

	Bob PendletonOn Mon, 2006-05-22 at 17:55 +0200, Andre Krause wrote:

but the resize bug is still open. any ideas? in the meanwhile, i’ll try
to debug a littlebit, maybe i can find the bug by myself.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+

Rasmus Neckelmann wrote:> On 5/20/06, Andre Krause <@Andre_Krause> wrote:

// my initialisation:
videoFlags = SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_RESIZABLE;

SDL_GL_DOUBLEBUFFER is not a SDL_SetVideoMode() flag. OpenGL
doublebuffering is specified exclusively by the SDL_GL_SetAttribute()
function (as you also do correctly).

The value of SDL_GL_DOUBLEBUFFER is 5, meaning that passing it as a
SDL_SetVideoMode() flag is the same as passing the flags SDL_HWSURFACE
(1) and SDL_ASYNCBLIT (2).
I don’t know whether that is the cause of your problem though, I would
assume those flags are ignored when using OpenGL. :slight_smile:

THANKS Alot! exactly that was the cause of the problem. i removed
SDL_GL_DOUBLEBUFFER from the videoflags and now resize works!

Bob Pendleton wrote:> On Mon, 2006-05-22 at 17:55 +0200, Andre Krause wrote:

Andre Krause wrote:

dear devlprs,

  1. the latest 1.2.10 release still has a resize bug under win32 opengl
    windowed, doublebufferd mode!
    if i make a resizable window, and resize it, the event structure gets
    NOT filled correctly! the event.resize.h field works fine, displays the
    new size. but in the event.resize.w field is an overflow:

“trying to resize to: 54985690x734 resize failed! error:”

… snip …

  1. there is another very annoying thing: if i restart my application,
    the window gets created every time on a new position on the screen. and
    that position shifts each time more downwards to the lower right corner
    of the screen, till finally the window is party occluded by the task bar
    (remember im talking about win32 environment) why simply center the
    window on the screen? where does this shift come from?

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

sorry for point 2.
i found out that it is indeed possible to center the window or even to
specify the x,y positions by using the environment vars
SDL_VIDEO_WINDOW_POS or SDL_VIDEO_CENTERED.
maybe a little notice in the documentation of SDL_SetVideoMode would
have avoided my question :slight_smile:

The documentation is in a wiki. If it needs to be corrected, please,
correct it.

  Bob Pendleton

but the resize bug is still open. any ideas? in the meanwhile, i’ll try
to debug a littlebit, maybe i can find the bug by myself.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

thanks for pointing out, added that to the wiki.
added:
“Note: If you want to control the position on the screen when creating a
windowed surface, you may do so by setting the environment variables
"SDL_VIDEO_CENTERED=center” or “SDL_VIDEO_WINDOW_POS=x,y”. You can set
them via SDL_putenv."