View Full Version : Disable window resizing in C

11-21-2011, 08:14 AM
I've been looking everywhere, and can't really find anything (search engines are awful sometimes) of any help to me. I need to know how to disable resizing of an OpenGL window in C (I'm using FreeGLUT on Linux, if any of that is important).

The sooner I get this figured out, the sooner I can get back to writing my wrapper for OpenGL and get started (one day) on my RPG. @_@;

carsten neumann
11-21-2011, 09:26 AM
I'm using FreeGLUT on Linux, if any of that is important

yes, because what you are asking for has actually nothing to do with OpenGL, it only depends on your windowing environment. With glut you are probably limited to registering a resize function and then use glutReshapeWindow to undo any resizing the user has done.

The sooner I get this figured out, the sooner I can get back to writing my wrapper for OpenGL and get started (one day) on my RPG

If you allow small problems like this halt your progress you are likely never getting there. This isn't really a showstopper for writing your game, just something can tackle somewhere along the way. So if something like this comes up again, put it aside, assume the best (i.e. in this case create a window of the expected size and assume the user does not resize for now) and come back to it at a later point - just don't forget about it completely or you will have surprised users ;)

For your particular problem: it is usually not considered nice to have just one fixed size window/resolution. So even if you are developing for a fixed size now you should consider keeping this flexible so that you can easily adapt to other sizes later.

11-21-2011, 09:37 AM
My primary reason for asking wasn't because it actually stops me from continuing or even gets in the way of my work. I can easily work with it as it is, considering everything will be contained within one, centralised viewpoint (though the maps themselves will be larger, that isn't my point). I just felt that window resizing isn't worth having in this, since there's no valid reason for wanting to resize the window. I appreciate the intent of the advice, so I guess I'll just ignore this for now. I've worked with SFML and SDL in the past, each of which having their own way to manage this resizing issue, and so I figured GLUT would have something along the same lines.

Important part: Thanks, not for solving the problem but rather reminding me that it shouldn't stop me and can be worked out later if I still feel it necessary. :)

11-21-2011, 09:54 AM
No need to ignore his advice, as it is an actual solution for glut.
I would only add : do not use glut, GLFW is better for a game.

11-21-2011, 10:19 AM
EDIT: I totally misread what you said, or maybe you changed it while I was editing. GLFW? I'll check it out, thanks! Hoping that's available for GNU/Linux.. @_@; Also, I wasn't going to ignore his advice. o_o

EDIT again: Found it, installed it, will now have a look at it and get started. Thanks! :D <UPDATE: Trying it out now, and I absolutely love it! GLFW is perfect. ^_^