5

Is it possible to disable a window resize created with opengl using c++? I'm looking for this because I'm trying to draw a graph and the letters in the scale (or title) will have their position changed after a resize.

tiggares
  • 475
  • 1
  • 5
  • 10
  • 3
    Hi tiggares - The question you have asked is not answerable in its current state. For starters which windows system are you using? Are you using MFC in windows, NSWindow on Mac, or are you using a library like GLUT? Window programming has nothing to do with OpenGL, since OpenGL is just a graphics API. This is really a windows/form question. Please provide which windowing system you're using. – Freddy Dec 08 '13 at 15:07
  • I'm using GLUT. It's likely I have solved my problem using glutFullScreen. – tiggares Dec 08 '13 at 16:40
  • glad to hear it. Just another option, their is a callback in glut when the window gets resized. If you didn't want to force your users into a full screen mode you could always register that callback with glut and have it reset your desired window size. Cheers! – Freddy Dec 08 '13 at 17:01
  • 1
    No, this cannot be done. As weird as this is going to sound, OpenGL does not even know what a window is. It was purposely designed in such a way that the closest OpenGL itself ever gets to a "window" is the framebuffer associated with a window. You need to use a platform-specific window API (e.g. WGL, GLX, CGL) to bridge the gap. Since many platforms have their own proprietary window systems, frameworks such as GLUT and glfw were created to completely hide the details from you. – Andon M. Coleman Dec 08 '13 at 23:17
  • Possible duplicate of [is it possible to create a fixed size glut window?](http://stackoverflow.com/questions/10691603/is-it-possible-to-create-a-fixed-size-glut-window) – Ciro Santilli OurBigBook.com Mar 27 '16 at 10:00

1 Answers1

5

That can't be done in OpenGL without a windowing API. Using GLUT, you can call glutReshapeWindow in the reshape callback to reset the size when the user tries to change it. Alternatively, if you don't need it windowed, go fullscreen via glutFullScreen to stop the user from reshaping the window. As far as I know that's the only portable way to do it.

Hope this helps.

Grimeh
  • 161
  • 1
  • 12