PDA

View Full Version : Sharing textures in AGL contexts? Part II


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

DoG
2004.10.05, 01:16 PM
AGL_FULLSCREEN does not prevent sharing with windowed contexts. I have no clue as to the proper way of displaying regular windows/panels over your full-screen context, though.

And you need 2 contexts at most, one for windowed and one for fullscreen mode. Check if your context #3 has any performance penalties, if not, stick with it to be able to display Carbon crap over your game.

OneSadCookie
2004.10.05, 05:12 PM
search the forums and you'll find how to share contexts between windowed and fullscreen.

Don't try to display dialogs over full-screen contexts. It doesn't work.

isgoed
2004.10.06, 04:06 AM
OK, thanks guys,

Now I at least know I am on the right track.