Intended behavior for OpenGL context loss

Hi,
I’ve just been starting to evaluate SDL 1.2 vs. 1.3 on Linux and
Windows. As is well known, when resizing an OpenGL window or going to
or from fullscreen mode the OpenGL context is sometimes lost depending
on the combination of SDL version and platform. The only combination
I have found where the context is never lost is SDL 1.2 on Linux.

Is there a plan for making it so that the OpenGL context is never,
ever lost on either SDL 1.2 or 1.3? Or is this even possible on
Windows. If it’s impossible I guess I’ll have to get started coding
the part of my game that will re-create all my OpenGL objects. Also,
if this is a task that’s just waiting to be worked on I might be able
to help with the coding. I really don’t know where to start right
now, though.–
Terry Welsh / mogumbo ‘at’ gmail.com
www.reallyslick.com / www.mogumbo.com

In general, if you resize a window you won’t lose your context. If
you resize a fullscreen mode or switch between windowed mode or
fullscreen mode, you’re likely to have to reload your context. You
should just plan for that in your design.On Thu, Oct 22, 2009 at 5:59 PM, Terry Welsh wrote:

Hi,
I’ve just been starting to evaluate SDL 1.2 vs. 1.3 on Linux and
Windows. ?As is well known, when resizing an OpenGL window or going to
or from fullscreen mode the OpenGL context is sometimes lost depending
on the combination of SDL version and platform. ?The only combination
I have found where the context is never lost is SDL 1.2 on Linux.

Is there a plan for making it so that the OpenGL context is never,
ever lost on either SDL 1.2 or 1.3? ?Or is this even possible on
Windows. ?If it’s impossible I guess I’ll have to get started coding
the part of my game that will re-create all my OpenGL objects. ?Also,
if this is a task that’s just waiting to be worked on I might be able
to help with the coding. ?I really don’t know where to start right
now, though.

Terry Welsh ?/ ?mogumbo ‘at’ gmail.com
www.reallyslick.com ?/ ?www.mogumbo.com


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Le Thu, 22 Oct 2009 21:01:26 -0700
Sam Lantinga a ?crit:

In general, if you resize a window you won’t lose your context. If
you resize a fullscreen mode or switch between windowed mode or
fullscreen mode, you’re likely to have to reload your context. You
should just plan for that in your design.

For SDL 1.3, wouldn’t it be possible to generate an event after
SDL_SetVideoMode() has been called, telling the application that the
OpenGL context has been kept, or recreated ?–
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux

I second that suggestion. Knowing when the context has changed would
prevent apps from doing unnecessary work. I’ve managed to make OpenGL
object re-initialization code that works pretty well, but I have to
run it after ever single resize.

I wanted to write this function in my app, but it looks like the
context in SDL 1.2 is buried down inside src/video/SDL_sysvideo.h,
which is not part of the regular API. I think I’d have to make a
custom build to get access to the context ID. I haven’t completely
traced the code for SDL 1.3, but I think the context is also not
available there.–
Terry Welsh / mogumbo ‘at’ gmail.com
www.reallyslick.com / www.mogumbo.com

Message: 4
Date: Fri, 23 Oct 2009 08:38:42 +0200
From: Patrice Mandin <mandin.patrice at orange.fr>
To: sdl at lists.libsdl.org
Subject: Re: [SDL] intended behavior for OpenGL context loss
Message-ID: <20091023083842.7789584a.mandin.patrice at orange.fr>
Content-Type: text/plain; charset=ISO-8859-1

Le Thu, 22 Oct 2009 21:01:26 -0700
Sam Lantinga a ?crit:

In general, if you resize a window you won’t lose your context. If
you resize a fullscreen mode or switch between windowed mode or
fullscreen mode, you’re likely to have to reload your context. You
should just plan for that in your design.

For SDL 1.3, wouldn’t it be possible to generate an event after
SDL_SetVideoMode() has been called, telling the application that the
OpenGL context has been kept, or recreated ?


Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux

Do SDL’s newer texture APIs automatically re-upload themselves?On Sun, Oct 25, 2009 at 7:09 PM, Terry Welsh wrote:

I second that suggestion. ?Knowing when the context has changed would
prevent apps from doing unnecessary work. ?I’ve managed to make OpenGL
object re-initialization code that works pretty well, but I have to
run it after ever single resize.

I wanted to write this function in my app, but it looks like the
context in SDL 1.2 is buried down inside src/video/SDL_sysvideo.h,
which is not part of the regular API. ?I think I’d have to make a
custom build to get access to the context ID. ?I haven’t completely
traced the code for SDL 1.3, but I think the context is also not
available there.

Terry Welsh ?/ ?mogumbo ‘at’ gmail.com
www.reallyslick.com ?/ ?www.mogumbo.com

Message: 4
Date: Fri, 23 Oct 2009 08:38:42 +0200
From: Patrice Mandin <mandin.patrice at orange.fr>
To: sdl at lists.libsdl.org
Subject: Re: [SDL] intended behavior for OpenGL context loss
Message-ID: <20091023083842.7789584a.mandin.patrice at orange.fr>
Content-Type: text/plain; charset=ISO-8859-1

Le Thu, 22 Oct 2009 21:01:26 -0700
Sam Lantinga a ?crit:

In general, if you resize a window you won’t lose your context. ?If
you resize a fullscreen mode or switch between windowed mode or
fullscreen mode, you’re likely to have to reload your context. ?You
should just plan for that in your design.

For SDL 1.3, wouldn’t it be possible to generate an event after
SDL_SetVideoMode() has been called, telling the application that the
OpenGL context has been kept, or recreated ?


Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux


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


http://codebad.com/

I forgot, there’s also this http://bugzilla.libsdl.org/show_bug.cgi?id=40On Sun, Oct 25, 2009 at 7:53 PM, Donny Viszneki <@Donny_Viszneki> wrote:

Do SDL’s newer texture APIs automatically re-upload themselves?

On Sun, Oct 25, 2009 at 7:09 PM, Terry Welsh wrote:

I second that suggestion. ?Knowing when the context has changed would
prevent apps from doing unnecessary work. ?I’ve managed to make OpenGL
object re-initialization code that works pretty well, but I have to
run it after ever single resize.

I wanted to write this function in my app, but it looks like the
context in SDL 1.2 is buried down inside src/video/SDL_sysvideo.h,
which is not part of the regular API. ?I think I’d have to make a
custom build to get access to the context ID. ?I haven’t completely
traced the code for SDL 1.3, but I think the context is also not
available there.

Terry Welsh ?/ ?mogumbo ‘at’ gmail.com
www.reallyslick.com ?/ ?www.mogumbo.com

Message: 4
Date: Fri, 23 Oct 2009 08:38:42 +0200
From: Patrice Mandin <mandin.patrice at orange.fr>
To: sdl at lists.libsdl.org
Subject: Re: [SDL] intended behavior for OpenGL context loss
Message-ID: <20091023083842.7789584a.mandin.patrice at orange.fr>
Content-Type: text/plain; charset=ISO-8859-1

Le Thu, 22 Oct 2009 21:01:26 -0700
Sam Lantinga a ?crit:

In general, if you resize a window you won’t lose your context. ?If
you resize a fullscreen mode or switch between windowed mode or
fullscreen mode, you’re likely to have to reload your context. ?You
should just plan for that in your design.

For SDL 1.3, wouldn’t it be possible to generate an event after
SDL_SetVideoMode() has been called, telling the application that the
OpenGL context has been kept, or recreated ?


Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux


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


http://codebad.com/


http://codebad.com/