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.
- 3Hi 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– Freddy2013-12-08 15:07:03 +00:00Commented Dec 8, 2013 at 15:07
- I'm using GLUT. It's likely I have solved my problem using glutFullScreen.tiggares– tiggares2013-12-08 16:40:41 +00:00Commented Dec 8, 2013 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– Freddy2013-12-08 17:01:02 +00:00Commented Dec 8, 2013 at 17:01
- 1No, 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– Andon M. Coleman2013-12-08 23:17:16 +00:00Commented Dec 8, 2013 at 23:17
- Possible duplicate of is it possible to create a fixed size glut window?Ciro Santilli OurBigBook.com– Ciro Santilli OurBigBook.com2016-03-27 10:00:08 +00:00Commented Mar 27, 2016 at 10:00
Add a comment |
1 Answer
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.