Resize OpenGL+SDL1.2 Window?

Resize OpenGL+SDL1.2 Window ???

Hi,

I understand how to setup a resizable SDL window,
but how would I easily resize an OpenGL back buffer to an SDL window?
(SDL window could be changed by the user, so may not be original
dimensions.)

Did alot of Googling, but have not found anything useful yet.

Thanks!

JeZ+Lee
www.SilentHeroProductions.com

I have some code that does this back at home, but I’m at work now.
But, as I remember, the general theory is to just re-setup the viewport.
Now, I’m not sure on this, but i’ve had random problems of OpenGL dropping textures when you do this (not always, but sometimes) so when you do this you might need to reload all the textures. So it would be something like:

case SDL_VIDEORESIZE:
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 32, SDL_HWSURFACE | SDL_RESIZABLE);
glViewport(0, 0, event.resize.w, event.resize.h);
ReloadTextures(); // Maybe?
break;

I’m not certain, but you might want to redefine the matrix. If nothing else, it can’t hurt even if it is redundant.

If you try this out and it still doesn’t work I’ll try to find that code when I get home. (I need to get my dyn-dns and ssh working again)
Hope it helps!

JeZ-l-Lee wrote:> Resize OpenGL+SDL1.2 Window ???

Hi,

I understand how to setup a resizable SDL window,
but how would I easily resize an OpenGL back buffer to an SDL window?
(SDL window could be changed by the user, so may not be original
dimensions.)

Did alot of Googling, but have not found anything useful yet.

Thanks!

JeZ+Lee
www.SilentHeroProductions.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi,

Thanks for the reply.

Have to go out now, but will try what you suggested tonight.

When your back home please send me your code that does this, thanks!

JeZ+Lee
www.SilentHeroProductions.com

MBrening wrote:> I have some code that does this back at home, but I’m at work now.

But, as I remember, the general theory is to just re-setup the viewport.
Now, I’m not sure on this, but i’ve had random problems of OpenGL
dropping textures when you do this (not always, but sometimes) so when
you do this you might need to reload all the textures. So it would be
something like:

case SDL_VIDEORESIZE:
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 32,
SDL_HWSURFACE | SDL_RESIZABLE);
glViewport(0, 0, event.resize.w, event.resize.h);
ReloadTextures(); // Maybe?
break;

I’m not certain, but you might want to redefine the matrix. If nothing
else, it can’t hurt even if it is redundant.

If you try this out and it still doesn’t work I’ll try to find that
code when I get home. (I need to get my dyn-dns and ssh working again)
Hope it helps!

JeZ-l-Lee wrote:

Resize OpenGL+SDL1.2 Window ???

Hi,

I understand how to setup a resizable SDL window,
but how would I easily resize an OpenGL back buffer to an SDL window?
(SDL window could be changed by the user, so may not be original
dimensions.)

Did alot of Googling, but have not found anything useful yet.

Thanks!

JeZ+Lee
www.SilentHeroProductions.com http://www.SilentHeroProductions.com


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You only have to use glViewport() to change the OpenGL framebuffer size, IIRC.

You may have to reload textures any time the windowing system destroys
your OpenGL context. Resizing might be one of them, but I think there
is a better way of detecting this that is orthogonal to the SDL_RESIZE
event.On Wed, Mar 17, 2010 at 8:26 AM, Jesse Palser wrote:

Resize OpenGL+SDL1.2 Window ???

Hi,

I understand how to setup a resizable SDL window,
but how would I easily resize an OpenGL back buffer to an SDL window?
(SDL window could be changed by the user, so may not be original
dimensions.)

Did alot of Googling, but have not found anything useful yet.

Thanks!

JeZ+Lee
www.SilentHeroProductions.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/