SDL_SetWindowFullscreen fails to set window to fullscreen mo |
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Sam Lantinga
Guest
|
Yeah, the fullscreen stuff isn't completely implemented yet, although I'll
fix the API call to return the correct status. What platform are you running on? Thanks! On Thu, Jul 30, 2009 at 2:25 AM, Kenneth Bull <llubnek at gmail.com> wrote:
-- -Sam Lantinga, Founder and President, Galaxy Gameworks LLC -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090802/4acf1fa8/attachment.htm> |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Kenneth Bull
Guest
|
2009/8/2 Sam Lantinga <slouken at libsdl.org>:
video driver would be x11 |
|||||||||||||
|
WaltN
|
What is the current status of this with SDL 1.3?
I'm running with Win32, and it does switch to full screen and back again, but the fullscreen display mode and position leaves something to be desired. It's not clear to me from the source code whether I should be doing something about size and position or whether that is work that remains to be done. I could use some guidance here. Walt |
|||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Sam Lantinga
|
Going fullscreen works on Windows and Mac OS X, but if you're
specifying a mode that isn't one of the available video modes, it doesn't properly center the display yet. See ya! On Wed, Dec 23, 2009 at 11:26 AM, WaltN wrote:
-- -Sam Lantinga, Founder and President, Galaxy Gameworks LLC _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Sam Lantinga
|
Going fullscreen works on Windows and Mac OS X, but if you're
specifying a mode that isn't one of the available video modes, it doesn't properly center the display yet. See ya! On Wed, Dec 23, 2009 at 11:26 AM, WaltN wrote:
-- -Sam Lantinga, Founder and President, Galaxy Gameworks LLC _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
WaltN
|
What I'm experiencing (with Windows Vista and SVN 5431) is that I have to set the window size following an SDL_SetWindowFullscreen in order to get a window of the proper size. I am specifying a proper display mode (one of those enumerated).
And, just to make sure we're on the same wavelength, what I get following an SDL_SetWindowFullscreen is a correct change of the Desktop display mode. The SDL window has a border and it needs to be resized and positioned in order to "fool" a user into seeing fullscreen mode. |
|||||||||||
|
hardcoder
|
In my case fullscreen on Windows starts correctly only with "d3d" renderer selected. For "gdi" or "opengl" window has correct size but is not correctly positioned.
|
|||||||||||
|
WaltN
|
I thought it might be worthwhile for me to post fragments of my code. First, here is my default window creation:
Desired fullscreen characteristics:
When I want to switch to fullscreen mode:
The fullscreen characteristics I get are a window with a resizeable border, and whose position is way off. I work around this by setting the size and position AFTER the call to SDL_SetWindow DisplayMode. But, the window I get is never a real borderless fullscreen window. (This with Vista.) It would be nice to have an example of code that works with the desired behavior. |
|||||||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Terry Welsh
Guest
|
I also cannot get fullscreen mode to work with SDL 1.3. I wrote a stripped down program which you can see below. This program starts up in windowed mode. If I press F1 to go fullscreen, nothing happens. But if I then move the mouse outside the window, it disappears and the program is still running. Creating the window with SDL_WINDOW_FULLSCREEN gives me a borderless window of the size specified (it does not fill the screen) that does not accept keyboard input. Is there something I'm missing? I haven't found much sample code for windowing with 1.3, so this is the best I've come up with so far. -- Terry Welsh / mogumbo 'at' gmail.com www.reallyslick.com / www.mogumbo.com #include <SDL.h> #include <iostream> #include <GL/gl.h> #define SDL_NO_COMPAT using namespace std; static bool gQuit(false); static SDL_WindowID gWindow; static SDL_GLContext gGLContext; int gWinW = 640; int gWinH = 480; bool gFullscreen = false; void resize(int w, int h){ if(gFullscreen) SDL_SetWindowFullscreen(gWindow, 1); else{ SDL_SetWindowFullscreen(gWindow, 0); SDL_SetWindowSize(gWindow, w, h); gWinW = w; gWinH = h; } glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glOrtho(-1,1,-1,1,-1,1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } void toggleFullscreen(){ gFullscreen = !gFullscreen; resize(gWinW, gWinH); cout << "fullscreen = " << int(gFullscreen) << endl; } void processEvents(){ SDL_Event event; while(SDL_PollEvent(&event)){ switch(event.type){ case SDL_WINDOWEVENT: switch(event.window.event){ case SDL_WINDOWEVENT_RESIZED: resize(event.window.data1, event.window.data2); break; } break; case SDL_QUIT: gQuit = true; break; case SDL_KEYDOWN: switch(event.key.keysym.sym){ case SDLK_ESCAPE: gQuit = true; break; case SDLK_F1: toggleFullscreen(); break; } break; } } } int main(int argc, char* argv[]){ if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0){ cout << "Unable to init SDL: " << SDL_GetError() << endl; exit(1); } atexit(SDL_Quit); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, ; SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, ; SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, ; SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5); gWindow = SDL_CreateWindow("Retrobooster", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, gWinW, gWinH, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); gGLContext = SDL_GL_CreateContext(gWindow); SDL_GL_SetSwapInterval(1); // v-sync on resize(gWinW, gWinH); while(!gQuit){ processEvents(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor4f(1,1,1,1); glBegin(GL_TRIANGLE_STRIP); glVertex3f(-0.5f, -0.5f, 0.0f); glVertex3f(0.5f, -0.5f, 0.0f); glVertex3f(0.5f, 0.5f, 0.0f); glEnd(); SDL_GL_SwapWindow(gWindow); } SDL_GL_DeleteContext(gGLContext); SDL_DestroyWindow(gWindow); return 1; } _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
WaltN
|
You might try specifying an SDL_DisplayMode structure either as I have (Desktop mode) or explicitly (e.g., pixel format of SDL_RGB888). Also, I've seen statements that suggest playing with depth buffer size (16, 24, 32). |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Terry Welsh
Guest
|
Thanks for the ideas Walt. No luck, though. I added this during
initialization: SDL_DisplayMode fsmode; SDL_GetDesktopDisplayMode(&fsmode); cout << fsmode.format << " " << fsmode.w << " " << fsmode.h << " " << fsmode.refresh_rate << " " << int(fsmode.driverdata) << endl; cout << "SDL_SetWindowDisplayMode = " << SDL_SetWindowDisplayMode(gWindow, &fsmode) << endl; The output I get is this: 2249594884 1920 1200 0 0 SDL_SetWindowDisplayMode = 0 Looks like my format was already set to SDL_PIXELFORMAT_RGB888. -- Terry Welsh / mogumbo 'at' gmail.com www.reallyslick.com / www.mogumbo.com
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Forest Hale
Guest
|
On 01/19/2010 06:53 PM, Terry Welsh wrote:
I could be wrong, but shouldn't SDL_NO_COMPAT be defined before including <SDL.h> ? A quick search indicates this is the case. -- Forest 'LordHavoc' Hale Author of DarkPlaces Quake1 engine and mod http://icculus.org/twilight/darkplaces Address: 94340 Horton Road Blachly OR 97412 Phone/Fax: 541-925-4130 _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
WaltN
|
In my case, #define SDL_NO_COMPAT doesn't make any difference. When I don't set size and position following a toggle to fullscreen, I get the same result as Terry Welsh -- no apparent effect. But, if I include setting size and position, the window is still bordered and resizeable. If I accept the default fullscreen mode, I get what looks like a 640x480 bordered window badly placed on a 640x480 desktop.
I get the feeling we're doing something basic that is dead wrong; hence the plea for sample code of the correct way to get the correct behavior. |
|||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Terry Welsh
Guest
|
That's correct, I have SDL_NO_COMPAT in the wrong place. I'll switch
it when I get home tonight but it shouldn't make any difference. The code I sent was stripped down from my game code where SDL_NO_COMPAT is part of the makefile. I just got it in the wrong order when I stripped it down. I tried stepping through the code to compare the SDL_compat path with my new 1.3-based code. Unfortunately, ddd wasn't cooperating and skipping around a lot (reminded me of debugging in VS). Anyway, as best I can tell in the SDL_compat path the window is destroyed and created again as a fullscreen window, a behavior I couldn't manage to mimic properly. My new 1.3-based path goes through the SDL_SetWindowFullscreen() but never seems to do any of the necessary things I'd expect, such as calling SDL_SetWindowPosition() and SDL_SetWindowSize(). Maybe that code is just unfinished. Still stumped. I'll probably try harder to mimic what SDL_compat does. I can't think of anything else to try without a good example program or documentation that says how to go fullscreen. -- Terry
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
WaltN
|
Terry, I don't think our problem has anything to do with 1.2 compatibility. Except for not seeing any change when fullscreen mode = Desktop mode, I really don't see any difference in behavior with other modes. On inspection, I really don't think that either of us is using any 1.2 functionality. Strangely, with Visual C++ 2009 Express, when I define SDL_NO_COMPAT, I loose Intellisense knowledge of almost all SDL names. And yet the program builds successfully. Given that, I don't view SDL_NO_COMPAT as helpful. (I suppose it could be a VC++ bug or even due to my ignorance.)
How can you tell? I've verified that the SDL_WINDOW_FULLSCREEN flag is getting set, but RESIZEABLE remains set. (OPENGL, SHOWN, INPUT_FOCUS, and MOUSE_FOCUS also set). I have not tried to verify whether the "real" window flags are getting altered. Certainly the display mode is changing if I request a size different from the Desktop mode. But, I see no signs of the window being destroyed and created. I believe that I'm getting a legitimate fullscreen window in that the window will cover up the Windows Taskbar. The shortcoming is that it's bordered and resizeable, and it's positioned badly. |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Terry Welsh
Guest
|
Hi Walt,
I think I was unclear in my previous post. The reason I was comparing the 1.3-based version of my code to my SDL_compat version is because in the compat version my window successfully goes fullscreen. ...well, almost successfully; I still have this input problem in Linux: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2009-December/073848.html But the important part is that I do get a fullscreen Window, so I figured the SDL_compat code should hold a good method for doing fullscreen windows. Although, destroying the old window and creating a new one seems heavy-handed to me if that's what's actually going on (still need more time to examine what's going on). -- Terry Welsh / mogumbo 'at' gmail.com www.reallyslick.com / www.mogumbo.com
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
can't switch to fullscreen |
augzilla
|
I think I ran into the same issue as you..; I couldn't switch to fullscreen from windowed. Specifically, I was creating a non-shown window first so that I could select the display mode with SDL_SetWindowDisplayMode (I couldn't find a better way -- and the ability to select refresh rate through the display mode is the reason that I am using SDL 1.3), and following it up with a call to SDL_SetWindowFullscreen.
I debugged it a bit and I think I found the main issue.. I didn't read the thread in detail, but I imagine you might have found it too. The display's num_windows member never got incremented on creation of a window (and also never gets decremented on killing of a window). Rather than risk missing places where it should be incremented or decremented, I added this simple function to SDL_video.c to work around the issue..:
.. and I removed num_windows from the SDL_VideoDisplay struct (and of course, I made use of this function to replace the references to num_windows in SDL_UpdateFullscreenMode). Having the proper window count allows it to transition to fullscreen and back. |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Sam Lantinga
|
This should be fixed in revision 5544, thanks!
On Sat, Jan 30, 2010 at 7:33 PM, augzilla wrote:
-- -Sam Lantinga, Founder and President, Galaxy Gameworks LLC _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
SDL_SetWindowFullscreen fails to set window to fullscreen mo |
Terry Welsh
Guest
|
Unfortunately, rev 5544 didn't change anything for me. Maybe I have a
different problem. My window still doesn't go fullscreen when commanded to and then disappears if I move the mouse out of it. I took a good hard look at the video code a couple weeks ago and couldn't figure out where the problem was. Hopefully I'll get to look at it again soon. -- Terry
SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
me too |
fareed_dudhia
|
having exactly the same problem at rev 5549.
compiled the tests and I get the exact same result when i use --fullscreen on the testgl2.exe. edit: screenshot edit #2: lines up properly in my desktop resolution (1280x1024) edit #3: GetWindowPosition tells me that the window is at (240,212). A call to SetWindowPosition does not move the window, but subsequent calls to GetWindowPosition reports it to be at (0,0) code:
[/code] |
|||||||||||||
|