PDA

View Full Version : Fullscreen OpenGL



gator
01-27-2003, 06:22 PM
Couple questions:

Do I have to destroy my main window and re-create it to go fullscreen?
Is this absolutely necessary?

If not, how can I go fullscreen without destroying my main window?

mdog1234
01-27-2003, 07:14 PM
are you using glut for windowing, because if you are there is a function called glutFullscreen

gator
01-27-2003, 07:28 PM
sorry, Microsoft MFC, win32 type stuff.

No glut, just plain OpenGL.

I tried modifying the dwStyle and dwExStyle of the window, but it doesn't give me
the fullscreen effect I'm looking for. I can still see edges around the window.

Not sure if my method is good, looking for an example.

Note that I know how to 'create' a fullscreen window from scratch, but what I need is
a way to go fullscreen without creating a new window, or destroying an old window.

[This message has been edited by gator (edited 01-27-2003).]

Relic
01-28-2003, 05:22 AM
A standard fullscreen "window" is normally done a simple WS_POPUP window.
If yours is a standard WS_OVERLAPPED, you might try to resize it so that the client size is the screen size and all non-client window parts are outside.
To do this you need the size of the caption bar and the size of the window frames in x and y.

Try something like this (not tried myself):
SetWindowPos(hWnd, HWND_TOPMOST, -GetSystemMetrics(SM_CXSIZEFRAME), -GetSystemMetrics(SM_CYSIZEFRAME) - GetSystemMetrics(SM_CYCAPTION), GetDeviceCaps(hdc, HORZRES), GetDeviceCaps(hdc, VERTRES), SWP_SHOWWINDOW | SWP_DRAWFRAME);

Maybe evaluate simpler if the frame is not drawn.

gator
01-28-2003, 01:01 PM
Ah, you gave me an idea. I'm not taking into account that I want the client window to
be full screen, and not the main window.

I think AdjustWindowRectEx() is what I'm looking for.

01-28-2003, 09:18 PM
I found some full-screen code here that was very useful... http://www.codesampler.com/oglsrc.htm

gator
01-29-2003, 04:52 PM
That example does shows how to create a fullscreen OpenGL window from scratch,
but it isn't what I'm looking for (see my second post).

But thanks anyway, I found a working solution.

shinpaughp
01-29-2003, 06:20 PM
Just so you don't feel like you are settling for a solution when you think there is a command to do it, there isn't. Check out the article on MSDN entitled - C++ Q&A: Full Screen Display and Implementing Drag to Move Dialogs by going to MSDN (http://msdn.microsoft.com) and in the search box type in "full screen display". The search should have that named link on the first or second page possibly number 10.

It describes how it can be done which is probably the solution you resorted to, basically resizing the window larger than the screen resolution and centering it.

I would have provided a direct link but it is microsoft using their asp and so a direct link does not work.

I edited the url for msdn


[This message has been edited by shinpaughp (edited 01-29-2003).]

gator
01-30-2003, 12:06 PM
Some good ideas in that article. Thanks.

shinpaughp
01-30-2003, 01:09 PM
Your welcome, though after looking at someone elses code just a little bit ago, there is a function to do it. There are 2 functions - ChangeDisplaySettings and ChangeDisplaySettingsEx. It does actually change the mode to full screen using CDS_FULLSCREEN flag. This is probably what you were looking for. Why it was not mentioned in that article, I do not know. Unless it will be phased out in the future... You'd think Microsoft would know their own APIs!!!

Anyway, glad the article helped, and hope this helps too.


Fixed some typos

[This message has been edited by shinpaughp (edited 01-30-2003).]

gator
01-31-2003, 12:28 PM
The way I understand it, you should only use ChangeDisplaySettings if
you want to go full screen in 'another resolution' other than your
desktop resolution. You don't have to use this function simply to
go fullscreen in every case.

I don't use it, and I get a clean toggle to fullscreen without my
monitor going black and getting screwed up.

And hiding the Start taskbar is not a problem, even if it has the
'Always on Top' property checked.