SDL + Mac OSX (Cocoa) |
Jesse A.
|
I don't have an answer, but here's some info that might be useful:
- SDL version (e.g. 1.2.x or 1.3) - OS X version - Video card - How you're switching between windowed and fullscreen modes (I know you mentioned SetVideoMode, which suggests 1.2.x, but as I understand it that function is still around for compatibility reasons, so I suppose you might be using 1.3.) |
|||||||||||
|
Neo_Darkboy
|
Ok, here is the info:
- I'm using 1.2.14 SDL version - The OS X Version is 10.6 - Intel gma 950 To switch between window and fullscreen i'm using the following code: flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_OPENGL | SDL_RESIZABLE; if(flags & SDL_FULLSCREEN) flags &= ~SDL_FULLSCREEN; else flags |= SDL_FULLSCREEN; screen = SDL_SetVideoMode( m_screenWidth, m_screenHeight, 0, flags ); after that i check if screen is null, then i set the video to the previous without the SDL_FULLSCREEN flag. But screen is not null at this point, the windows switch to fullscreen, but everything is black, and if i switch back to windows, still remains black, so what do you think is the problem? i've tried recreating the open gl context with no result |
|||||||||||
|
Jesse A.
|
How are you recreating the OpenGL context? (I don't recall that being exposed directly in SDL 1.2.x.) |
|||||||||||||
|
Neo_Darkboy
|
well actually i'm not recreating it, just setting some attributes:
but i dont think that's the problem, i think i'm missing something, could you help me with this please? |
|||||||||||||
|
Jesse A.
|
I can't remember exactly which circumstances exhibit this behavior (I think it depends, among other things, on SDL version, OS, and the action being performed), but I think in some cases resetting the video mode will lose the OpenGL context. This means that all state - including, among other things, transforms and texture objects - will be lost and will need to be reinitialized after a video restart.
If you're using textures, try unloading them (glDeleteTextures()) before resetting the video mode, and reloading them afterwards. Also, make sure that after resetting the video mode you reset the OpenGL state as needed. (Assuming, of course, that that's the cause of the problem you're seeing.) |
|||||||||||
|
Neo_Darkboy
|
In fact, the OpenGL context is lose after toggling the fullscreen/window, but will be painful to reload all the textures in every switch, so i think the best choice is to use the cocoa api instead of sdl, because i need some control of the window that sdl cannot let to work, like minimize in fullscreen, show pop up dialogs, etc.
Thanks for your answers! |
|||||||||||
|
SDL + Mac OSX (Cocoa) |
Sam Lantinga
|
SDL 1.3 handles those things just fine, and doesn't lose OpenGL context while toggling fullscreen/windowed mode.
On Tue, Mar 8, 2011 at 4:51 PM, Neo_Darkboy wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
|||||||||||||
|
SDL + Mac OSX (Cocoa) |
Sam Lantinga
|
You can check out a pre-release snapshot here:
http://www.libsdl.org/tmp/SDL-1.3.zip On Tue, Mar 8, 2011 at 5:15 PM, Sam Lantinga wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
|||||||||||||||
|
SDL + Mac OSX (Cocoa) |
Armin Ronacher
Guest
|
Hi,
On 3/4/11 2:31 AM, Neo_Darkboy wrote:
SDL_FULLSCREEN on OS X. The reason for this is that fullscreen mode on OS X means the application has exclusive access to the keyboard and a bunch of other things and OS X will not provide an fast application switcher then (cmd+tab). Instead I am currently using something along these lines: #if PD_PLATFORM == PD_PLATFORM_OSX int flags = SDL_GetWindowFlags(m_win); SDL_Window *new_win; if (value) { /* we cannot toggle borderless and regular window mode, so we have to recreate the window. Sucks but well but works. */ SDL_DisplayMode mode; SDL_GetDesktopDisplayMode(SDL_GetWindowDisplay(m_win), &mode); new_win = SDL_CreateWindow(SDL_GetWindowTitle(m_win), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, mode.w, mode.h, flags | SDL_WINDOW_BORDERLESS); SDL_GetWindowDisplayMode(m_win, &mode); m_osx_alternative_width = (size_t)mode.w; m_osx_alternative_height = (size_t)mode.h; } else { /* same thing, different direction */ new_win = SDL_CreateWindow(SDL_GetWindowTitle(m_win), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (int)m_osx_alternative_width, (int)m_osx_alternative_height, flags & ~SDL_WINDOW_BORDERLESS); } SDL_DestroyWindow(m_win); m_win = new_win; SetSystemUIMode(value ? kUIModeAllHidden : kUIModeNormal, 0); SDL_GL_MakeCurrent(m_win, m_glctx); Apparently the Mac version of HoN (a dota clone) has exclusive screen access and still supports cmd+tab. I don't own the game and a friend of mine told me they support that so I have no idea how the managed to accomplish that. If anyone knows, it would be nice figuring that out and maybe even implement it in SDL itself. The downside of my solution is that it only supports fullscreen for native screen sizes which is annoying for notebook users with high resolution screens. The OS X graphics devices are often not powerful enough to render at that resolution. Regards, Armin _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Neo_Darkboy
|
wow, that is a nice solution, creating a new window, but i have the same problem that you have, the events are not received in fullscreen mode, and i need to support cmd+tab, command + m, command + shift + eject, etc, but it will require a lot of investigation, what i've found, is that may be, when the app is in fullscreen mode, is on the top level of all events/applications or something like that, and that's why the events are not received. And there is some code to do in cocoa that make the window not to be at top, so it can receive all kind of events, but i have not check the documentation to see how this works, may be this could help you
|
|||||||||||
|
SDL + Mac OSX (Cocoa) |
Eric Wing
Guest
|
I haven't checked the new 1.3 code yet. Are we using NSView's enterFullScreen:withOptions:? Apple changes how to do fullscreen every few years. As I understand it, this is the one they want us to use now. It should behave more as a Mac user expects provided you can pass it the correct "options". -Eric -- Beginning iPhone Games Development http://playcontrol.net/iphonegamebook/ _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL + Mac OSX (Cocoa) |
Sam Lantinga
|
No, we're using the real mode change code.
enterFullScreen:withOptions just puts a shielding window up over the current resolution, and for some reason actually crashes with the SDL view. On Thu, Mar 10, 2011 at 8:41 PM, Eric Wing wrote:
-- -Sam Lantinga, Founder and CEO, Galaxy Gameworks |
|||||||||||||||
|
SDL + Mac OSX (Cocoa) |
Eric Wing
Guest
|
On 3/10/11, Sam Lantinga wrote:
I don't know if things have changed, but I asked some Apple OpenGL engineers about this a couple of years ago. They said they were optimizing for this case and they intend the API to do the right thing depending on the case. -Eric -- Beginning iPhone Games Development http://playcontrol.net/iphonegamebook/ _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL + Mac OSX (Cocoa) |
Armin Ronacher
Guest
|
Hi,
On 3/10/11 11:41 PM, Eric Wing wrote:
fullscreen support might also have some implications in how OpenGL is supposed to work. Regards, Armin _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|