Thread: OpenGL GLUT Fullscreen / Windowed Switching

  1. #1
    * S T U D E N T *
    Join Date
    Oct 2003
    Posts
    30

    Angry OpenGL GLUT Fullscreen / Windowed Switching

    Hi peeps

    Having a little trouble here

    I want to switch between windowed and fullscreen modes using GLUT using key 'f' or key 'F'.

    I found a glutFullScreen() method which works fine, but when it switches back to windowed (which takes 4 times to press f) makes the size of the window fine but it comes without its title bar etc!

    so erm
    ive tried lots of different glut methods
    and i cant seem to work out whats goin on
    ive searched mr.google and cant find a way out

    what is glutentergamemode glutleavegamemode all about, is it better, nicer, newer and does it even do this?! :S

    any ideas?....


    --Chris

  2. #2
    * S T U D E N T *
    Join Date
    Oct 2003
    Posts
    30
    heres the code for what i got so far....

    Code:
        case 70:
        case 102: /* Fullscreen mode (Additional) : f/F */
          fullscreen = !fullscreen;
          if (fullscreen)
          {
    	glutFullScreen();                /* Go to full screen */
          }
          else
          {
    	glutReshapeWindow(800, 600);        /* Restore us */
            glutPositionWindow(0,0);
          }
          break;
    but i want to set it to the width height of the window before fullscreen, but it doesnt like that in glutReshapeWindow()

  3. #3
    It could be that the program is still operating in fullscreen mode, but you are making the size of the window less than your resolution, so it is working similiar to a WS_POPUP window. You probably have to do a command to kick it out of fullscreen mode after the window is resized.

  4. #4
    * S T U D E N T *
    Join Date
    Oct 2003
    Posts
    30
    full screen mode?
    sounds logical but how do i get 'out' of full screen mode?
    all i get is a window without the attributes iof the window like minimize maximize close and the title bar....

    i changed the code so that pressing 'w' changes reolution between:#
    640x480
    800x600
    1024x768
    fullscreen (and back again of course)

    Code:
        case 87:
        case 119: /* Window size (Additional) : w/W */
          if (width == 640)
           {
    	 width = 800;
    	 height = 600;
    	 glutReshapeWindow(width, height); 
           }
           else if (width == 800)
           {
    	 width = 1024;
    	 height = 768;
    	 glutReshapeWindow(width, height);
           }
           else if (width == 1024)
           {
    	 glutFullScreen();
           }
           else
           {
    	 width = 640;
    	 height = 480;
    	 glutReshapeWindow(width, height);
           }
           break;
    please please please help me, im a n00b, and i cant find the answer anywhere!

  5. #5
    Registered User Strider's Avatar
    Join Date
    Aug 2001
    Posts
    149
    Not sure about the key press problem (maybe try using a different set of keys like '+' and '-').

    As far as the title bar disappearing, try setting the window position further in:
    Code:
    glutPositionWindow(100,100);
    That seems to work for me.

    David
    One Ring to rule them all, One Ring to find them,
    One Ring to bring them all and in the darkness bind them
    In the Land of Mordor where the Shadows lie.

  6. #6
    * S T U D E N T *
    Join Date
    Oct 2003
    Posts
    30
    key press problem i solved by using the same keypress for all windows...

    unfortunately the window position hasnt helped

    thanks anyway

    i must be making a fundamental mistake (wouldnt put it past myself )

    --Chris

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM