isgoed
2004.10.05, 10:29 AM
Is there any elegant way to share textures and display lists over two AGL contexts?
I'm trying to:
let the player switch from fullscreen to window mode on-the-fly
AND be able to use carbon dialogs while in fullscreen (to save myself the problems of designing an OpenGL interface with all the buttons and checkboxes)
I can actually do this already, but I don't like the way how I do it. I use AGL to make 3 contexes, for 4 situations:
a window contex: For use in windowed mode.
the same contex as (1), only I resize the port: To use as a blanking window (while I am in the interface) in order to use carbon dialogs.
A semi Fullscreen context: For use in fullscreen when no dialogs are present. This context is made by setting the screen to fullscreen and building a drawable on that screen's CGrafPort.
A true Fullscreen context: This context can only be used while actually playing the game and cannot escape to another context. The context is created with aglSetFullScreen.
the problems that arise are:
Context (4) cannot share textures graphics and display lists with any other context, since it requires AGL_FULLSCREEN in the PixelFormat/Attributes, so sharing the context is impossible. This means that to switch contexes, all textures need to be reloaded. Else it will be impossible to switch to windowed mode on the fly.
Context (3) is slower than context (4). I believe context (4) uses tripple buffering.
Context (3) cannot be used to show dialogs (I believe)
I doubt that there will be a smooth solution for this? I think the best thing to do is to skip context (4) all together in order to have the most robust code on the expense of speed. How have you guys solved this problem?
PS: a year ago this same question was also addressed. By Fenris; thanks btw ;)
http://www.idevgames.com/forum/showthread.php?t=4216&highlight=fullscreen+window
I'm trying to:
let the player switch from fullscreen to window mode on-the-fly
AND be able to use carbon dialogs while in fullscreen (to save myself the problems of designing an OpenGL interface with all the buttons and checkboxes)
I can actually do this already, but I don't like the way how I do it. I use AGL to make 3 contexes, for 4 situations:
a window contex: For use in windowed mode.
the same contex as (1), only I resize the port: To use as a blanking window (while I am in the interface) in order to use carbon dialogs.
A semi Fullscreen context: For use in fullscreen when no dialogs are present. This context is made by setting the screen to fullscreen and building a drawable on that screen's CGrafPort.
A true Fullscreen context: This context can only be used while actually playing the game and cannot escape to another context. The context is created with aglSetFullScreen.
the problems that arise are:
Context (4) cannot share textures graphics and display lists with any other context, since it requires AGL_FULLSCREEN in the PixelFormat/Attributes, so sharing the context is impossible. This means that to switch contexes, all textures need to be reloaded. Else it will be impossible to switch to windowed mode on the fly.
Context (3) is slower than context (4). I believe context (4) uses tripple buffering.
Context (3) cannot be used to show dialogs (I believe)
I doubt that there will be a smooth solution for this? I think the best thing to do is to skip context (4) all together in order to have the most robust code on the expense of speed. How have you guys solved this problem?
PS: a year ago this same question was also addressed. By Fenris; thanks btw ;)
http://www.idevgames.com/forum/showthread.php?t=4216&highlight=fullscreen+window