| | |
Disabling fullscreen using GLUT
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
So I'm working on this OpenGL 3D Graph program, and like, I ran into some trouble, since I wanted it to support fullscreen, so I made the following;
Which is calling the following function;
WindowWidth and WindowHeight are both global variables, which are updated everytime I'm resizing the window.
fullscreen is a global bool.
The problem is, that going to fullscreen is working fine, however returning to windowed mode, is giving me some problem since it returns with a window resolution equal to my desktop resolution, and not the resolution which is givin' in the variables WindowWidth and WindowHeight.
Anyone able to figure out the problem?
EDIT; I'm able to get it into a fixed resolution using fixes values instead of the variables like this;
However to make this work I'm forced to call the "ResetWindowSize" function twice?
C++ Syntax (Toggle Plain Text)
int main(int argc, char *argv[]) { ... // Some stuff glutSpecialFunc(SpecKey); ... // More stuff }
Which is calling the following function;
C++ Syntax (Toggle Plain Text)
GLvoid ResetWindowSize(GLvoid) // Reset WindowSize { glutReshapeWindow(WindowWidth, WindowHeight); glutPositionWindow(0,0); } GLvoid SpecKey(GLint key, GLint x, GLint y) { if (key == GLUT_KEY_F1) // Toggle FullScreen { fullscreen = !fullscreen; // Toggle FullScreenBool if (fullscreen) { glutFullScreen(); // Enable Fullscreen } else { ResetWindowSize(); // Make Window, and resize } } }
WindowWidth and WindowHeight are both global variables, which are updated everytime I'm resizing the window.
fullscreen is a global bool.
The problem is, that going to fullscreen is working fine, however returning to windowed mode, is giving me some problem since it returns with a window resolution equal to my desktop resolution, and not the resolution which is givin' in the variables WindowWidth and WindowHeight.
Anyone able to figure out the problem?
EDIT; I'm able to get it into a fixed resolution using fixes values instead of the variables like this;
C++ Syntax (Toggle Plain Text)
GLvoid ResetWindowSize(GLvoid) // Reset WindowSize { glutReshapeWindow(800, 600); glutPositionWindow(0,0); }
![]() |
Similar Threads
- what's a GL/glut.h? (C)
- Help make Console App Open in fullscreen. (C++)
- glut (C)
- making current window change to fullscreen, Ive looked everyhwhere and came here .... (HTML and CSS)
- Robot with GLUT? (C)
- Windows MP Won't go to fullscreen (Windows NT / 2000 / XP)
- Disabling Internet Explorer on a Terminal server (Web Browsers)
- DivX problem at fullscreen (Windows Software)
- Disabling Win XP standard picture/fax viewer (Windows NT / 2000 / XP)
- Do I have to sign my applet to run it with fullscreen? (Java)
Other Threads in the C++ Forum
- Previous Thread: Max Height formula
- Next Thread: how i do this project in c++
| Thread Tools | Search this Thread |
advertising age ajax amd android api apple application asp avatar blog blogger blogging bluegene browser bugs business c# c/c++ cellphone chips code compiler database design developer development dos economy energy enterprise firefox game gaming gdata gecko google graphics hardware ibm ibm.news intel intelibm internet iphone java law linux marketing math medicine memory microsoft mobile mozilla msdn news nvidia office opengl openoffice opensource opera operatingsystems os patents pc privacy programming ps3 recession redhat revenue rss russia search security software sql sun supercomputer supercomputing technology tools trademark trends ubuntu video virtualization vista w3c web webmaster wiki windows windows7 working x86 xml youtube






