View Full Version : Fullscreen mode
02-25-2001, 10:28 AM
this may seem a silly question... but... how do you make an OpenGL program run in full screen?
02-25-2001, 10:55 AM
In Windows I presume? If so, you just change into the graphics mode you want to use, then create a pop-up window that is the same size as the screen. Then create the render context and initialize OpenGL.
[This message has been edited by DFrey (edited 02-25-2001).]
02-25-2001, 11:01 AM
Then I still have a taskbar and title bar... and how do I change screen modes?
02-26-2001, 04:33 AM
Use ChangeDisplaySettings( ... )
02-26-2001, 03:51 PM
Add the topmost flag to get rid of the taskbar. It is not necessary to change display settings. Here is a hacked version of NeHe tutorial 5 that demonstrates different fullscreen modes: http://sites.netscape.net/ptrpck/switch.zip
02-26-2001, 04:08 PM
Are you suggesting that it is not necessary to change into 640x480x16 mode if I want to run fullscreen at that setting and the desktop is in 1024x768x32 mode?
02-27-2001, 07:21 AM
Talking with me?
02-27-2001, 10:06 AM
Uh, no, mango. He wrote, "It is not necessary to change display settings". But it obviously is necessary to change the display mode if you want to run full screen at a resolution and/or color depth that is different from the desktop.
02-27-2001, 03:01 PM
The question was "how do you make an OpenGL program run in full screen?" and the answer is that you creates a windows that is completly covering the screen without the GUI stuff. You do not have to change display settings for doing that.
DFrey, your reply gave a rude impression and if that was your intention do I suggest that you stop. Instead of writing about things you belive is obvious true could you have examined the sample program.
Yes, a fullscreen window is a window that covers the entire screne, and does not have any fancy buttons/bars/whatever. But what is your desktop is 1280x1024x32, and you want your application to run in fullscreen 640x480x16. How can you do that without change the display settings?
02-28-2001, 03:15 AM
You can't. Why don't you want to do that?
02-28-2001, 09:41 AM
To me, it seems the most common reason for writing a fullscreen app would be to change the display mode to get better performance. Obviously, you can write a fullscreen app without changing the display mode, and there might be cases where this is what you'd want, but most games that run fullscreen DO change the display mode. Actually, I'm not aware of any that don't unless you are already running your desktop in the mode the game wants to use.
02-28-2001, 07:13 PM
Yes, but changing display settings can be difficult. I think it is best to start the game in fullscreen mode without changing display settings so that the players can select settings that works on their systems.
If your desktop is 1280x1024x32 can you not enter 640x480x16 mode without changing the display settings. My previous post seems to say that but I was annoyed by having to defend things I never wrote and I guess that affected me.
Fullscreen mode is just a special kind of window in the same size as the screen and display settings is something else. It does not make sense to treat them as one.
Initialise directx and select your video mode, then initialise opengl under directx doing all that wgl stuff with the hwnd and hdc. This works under NT, haven't tried 95/98/2000, personally I was surprised that this worked, but its perfect!
[This message has been edited by Leo (edited 03-06-2001).]
03-06-2001, 03:15 PM
that sounds hard
03-07-2001, 06:08 AM
There is a way to run GLUT full-screen I bet - I just don't know what it is. Anyone?
Tutorial here: http://www.dev-gallery.com/programming/opengl/fullscreen/fullscreen.htm
03-07-2001, 12:42 PM
This tutorial is also very helpful. It explains how to use fullscreen with Win32 http://nehe.gamedev.net/tutorials/lesson01.asp
I will personally track down and frag anyone who initializes their display mode with DirectX to use OpenGL http://www.opengl.org/discussion_boards/ubb/smile.gif If I recall correctly (and I might not) Microsoft does NOT garuntee that using OpenGL after initializing a DirectX window will work (though that might not apply in this situation...).
Thats a lot of hard work that is unnecessary, ChangeDisplaySettings() is very easy to use.
Glut is better but I'd prefer not to use it (personal opinion) unless I planned on writing a multiplatform application (in that case I would probably still learn how to do it myself the other platforms).
Malevolent, take a look at NeHe's tutorial that dpgraves suggested, thats exactly where I (and many thousands of others) have started.
And no, it is not necessary to change the display mode to create a fullscreen window. But on every card made since the late 80's its safer to start in 640x480 than ANY other mode (8bit too http://www.opengl.org/discussion_boards/ubb/smile.gif). I'm having the current problem with my new GeForce 2 MX with the Vulpine GLMark demo that it gives me "Frequency over range" on my monitor EVEN WHEN I'M RUNNING THE SAME RESOLUTION AS MY DESKTOP!!!!! (obviously something is fishy there, there shouldnt be any problem using a mode thats in use) but why even make a fullscreen GL program to select settings? Why not just pop a dialog box (with a handy checkbox to make sure it never asks me again please).
BwB: Personally I never even heard of opengl and DX being interoperable. I doubt very much that its supported, but its my assumption that they work together because they both work at the same privilege level, but mixing D3D and OpenGL would probably cause problems. Its something I stumbled across on a rainy day. I had a load of code so I thought what if, only took an hour! I have a suspetion that if only works on NT4, but thats still useful. I haven't tried acelerated hardware with it. Has any one tried it on 95/98/2000/ME?
Admittedly I get a very odd SQL error when I try and run the binaries on 98, and it won't compile. Hmmm, maybe your right http://www.opengl.org/discussion_boards/ubb/smile.gif
If anyone want the code for it, a very simple DevStudio project I''ll email it to them.
[This message has been edited by Leo (edited 03-08-2001).]
03-08-2001, 10:22 PM
Using DX is not something new it is even in the FAQ: http://www.opengl.org/developers/faqs/technical/mswindows.htm#mswi0060
BwB, I think some manufacturers like nvidia is using DX to initialize the display so you will have a lot of fragging to do! http://www.opengl.org/discussion_boards/ubb/smile.gif
Using the NeHe code does not work on all systems because:
- In KillGLWindow is the display settings changed before killing the window. That will crash on some systems.
- the topmost flag is not set so the second time you enter fullscreen is the taskbar not hidden. Perhaps this is also depending on the system.
- the error message talks about not supported modes if ChangeDisplaySettings fails, the problem is instead that the program can not change to the new mode.
I think the GLUT code is good but it will still crash! I can hear if the display settings is changed and if glutEnterGameMode does that will the app crash after some successful changes. One example that lets you switch windowed - fullscreen with glutGameMode is here: http://sites.netscape.net/ptrpck/glut10.zip
If you put your desktop in 16 bit color mode should the program really change the display settings. I can enter fullscreen mode about 6 times before the crash. That may sounds like a lot but it is really random depending on compiler and all kind of weird stuff
The big problem is not setting any unsupported modes but the _switching_ itself. It seems to give random crashes depending on the phases of the moon...
The only really safe way is to first enter fullscreen without any changes of the display settings and allow the user select settings before really changing them. If the program then can not do the changes is it easy to tell the user that a manual change is required.
If the program crash will a user at least know what the settings are and can do manual changes.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.