Results 1 to 6 of 6

Thread: How can I force a window to be unresizeable

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005
    Posts
    1

    How can I force a window to be unresizeable

    Using GLUT, even I don't register a ReshapeFunc, a default reshape function is called, which calls glViewport(0, 0, width, height).

    However, can I force the window cannot be resized?

    --NeoRc

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: How can I force a window to be unresizeable

    Hi !

    I am not sure, but as far as I know you cannot stop a window from being resized with glut unless you start to poke around with OS specific code.

    Mikael

  3. #3
    Member Contributor
    Join Date
    Jan 2005
    Location
    Karachi, Pakistan
    Posts
    85

    Re: How can I force a window to be unresizeable

    Well it can be done. You can create a Reshape function and set the viewport and window to your required size. This way whenever the user resizes the window, the contents would not change.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: How can I force a window to be unresizeable

    That is true, but I think he wanted to stop the user from resizing the window.

    Mikael

  5. #5
    Member Contributor
    Join Date
    Jan 2005
    Location
    Karachi, Pakistan
    Posts
    85

    Re: How can I force a window to be unresizeable

    Originally posted by mikael_aronsson:
    That is true, but I think he wanted to stop the user from resizing the window.

    Mikael
    Window resizing can be stopped using the glutReshapeWindow function. Do the following in your reshape function.

    //Assuming you want to set window size to 400x400
    void Reshape(int nWidth, int nHeight)
    {
    glutReshapeWindow(400,400);
    }

    Hope this will solve your problem. Note that doing so allows user to see the resize cursor and mask line but the window does not resize.

  6. #6
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: How can I force a window to be unresizeable

    As Mikael said, the only way to do this gracefully is to deal with the windowing system directly. Fortunately, this isn't difficult at all. You just need to poke around in the windows docs.

    Add this code right after glutCreateWindow, before the main loop:
    Code :
    if( HWND hWnd = WindowFromDC(wglGetCurrentDC()) )
    	SetWindowLong( hWnd, GWL_STYLE, (DWORD)GetWindowLong( hWnd, GWL_STYLE ) & ~WS_SIZEBOX );

Similar Threads

  1. Force to an OpenCL version
    By ffelagund in forum OpenCL
    Replies: 0
    Last Post: 03-20-2012, 03:08 AM
  2. Force repaint
    By devdept in forum OpenGL: Advanced Coding
    Replies: 20
    Last Post: 06-26-2009, 08:56 AM
  3. Force specifications!
    By santyhamer in forum OpenGL: General
    Replies: 6
    Last Post: 02-17-2004, 03:44 PM
  4. Ge force 2 MX 200 PCI and no open GL
    By Paul Rollinson in forum OpenGL: User Software
    Replies: 0
    Last Post: 05-12-2003, 06:02 AM
  5. GE-Force 3 HELP!
    By Richard Jones in forum OpenGL: User Software
    Replies: 0
    Last Post: 11-26-2002, 10:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean