Repost: Tips for switching from fullscreen/window

BlitzMax Forums/MiniB3D Module/Repost: Tips for switching from fullscreen/window

ima747(Posted 2011) [#1]
Slotman posted this in the Mac forum regarding the apple mac app store. One of the requirements for the app store is if you support windowed and full screen modes you have to be able to switch between them with a keystroke.

Of note, you have to enable openGL shared contexts before creating your first openGL context for this to work (otherwise when you destroy one it will wipe your resources like textures...).

I have not personally implemented this yet, but I'm posting it here so it's handy when I or anyone else needs to go looking for it.


SLotman (Posted 2 days ago) #45
This is basically what I do:

I have added a var called B3DGraphics (Global B3DGraphics:TGraphics
on TGlobal type) which basically stores the result given by the Graphics command, so I can call CloseGraphics() when restarting.

(from TGlobal.bmx, Graphics3D function)
B3DGraphics = Graphics(width,height,depth,rate,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER|GRAPHICS_ACCUMBUFFER)


Then it's a matter of opening a new video mode, and that's it!

CloseGraphics(TGlobal.B3DGraphics)
EndGraphics()

Graphics3D ScreenWidth,ScreenHeight,ScreenBpp, WindowMode


sorry for not posting the full code I use, because it's all tied up with several other things I've been doing, and would only clutter the simple code above :)



Last edited 2011