Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

glut fixed window size (disable resize)

1,884 views
Skip to first unread message

grayaii

unread,
Apr 14, 2009, 11:00:51 AM4/14/09
to
Hi,

I'm having a hard time making my window a fixed size. I realize this
is not an OpenGL issue, but I've tried other forums and no one even
replied. I'm trying to prevent users from resizing my window and
according to my searches, there *is* a way to do this via glut, but I
haven't had any success with any of the explanations that I found.

For instance, I tried this ("reshape" is my function that is
registered via "Glut.glutReshapeFunc(reshape);"):

void reshape(GLsizei width, GLsizei height) // the reshape function
{
// FORCE it to be 800 by 600
glViewport(0,0,800,600) ;
glMatrixMode(GL_PROJECTION);
glLoadIdentity() ;
glOrtho(0.0f,800,600,0.0f,-1.0f,1.0f);
glMatrixMode(GL_MODELVIEW) ;
glLoadIdentity() ;
}

or

void reshape(GLsizei width, GLsizei height) // the reshape function
{
// FORCE it to be 800 by 600
Glut.glutReshapeWindow(800, 600);
}


Both of these cases don't work. The user can still resize my window.
Note that glutReshapeWindow works, as long as it's not in the reshape
function...

(I got the above examples from the following topics:)
http://www.gamedev.net/community/forums/topic.asp?topic_id=467668
http://www.gamedev.net/community/forums/topic.asp?topic_id=114801

Is there a way to do this via glut? (I'm using C#, if that helps any)
thanks.

hanukas

unread,
Apr 15, 2009, 2:33:27 AM4/15/09
to
On Apr 14, 6:00 pm, grayaii <gray...@gmail.com> wrote:
> Hi,
>
> I'm having a hard time making my window a fixed size. I realize this
> is not an OpenGL issue, but I've tried other forums and no one even
> replied.  I'm trying to prevent users from resizing my window and
> according to my searches, there *is* a way to do this via glut, but I
> haven't had any success with any of the explanations that I found.
>
> For instance, I tried this ("reshape" is my function that is
> registered via "Glut.glutReshapeFunc(reshape);"):
>
> void reshape(GLsizei width, GLsizei height) // the reshape function
> {
>    // FORCE it to be 800 by 600
>    glViewport(0,0,800,600) ;
>    glMatrixMode(GL_PROJECTION);
>    glLoadIdentity() ;
>    glOrtho(0.0f,800,600,0.0f,-1.0f,1.0f);
>    glMatrixMode(GL_MODELVIEW) ;
>    glLoadIdentity() ;
>
> }
>
> or
>
> void reshape(GLsizei width, GLsizei height) // the reshape function
> {
>    // FORCE it to be 800 by 600
>    Glut.glutReshapeWindow(800, 600);
>
> }
>
> Both of these cases don't work. The user can still resize my window.
> Note that glutReshapeWindow works, as long as it's not in the reshape
> function...
>
> (I got the above examples from the following topics:)http://www.gamedev.net/community/forums/topic.asp?topic_id=467668http://www.gamedev.net/community/forums/topic.asp?topic_id=114801

>
> Is there a way to do this via glut? (I'm using C#, if that helps any)
> thanks.

I don't use GLUT but the first thing I would do is to look for
CreateWindow call in GLUT and see what flags the window style gets.
You want to disable the resize control, it's one bit in the ws flags.
See if you can affect the flags's value with GLUT from client side, if
not, modify the GLUT source code and recompile the library.

Wolfgang Draxinger

unread,
Apr 15, 2009, 3:24:26 AM4/15/09
to
grayaii wrote:

> Hi,
>
> I'm having a hard time making my window a fixed size. I realize
> this is not an OpenGL issue, but I've tried other forums and no
> one even
> replied. I'm trying to prevent users from resizing my window
> and according to my searches, there *is* a way to do this via
> glut, but I haven't had any success with any of the
> explanations that I found.

Don't use GLUT then. That's something you can't to reliably with
GLUT. For applications like that I recomment using SDL, which
creates fixed size windows by default.

Wolfgang

grayaii

unread,
Apr 16, 2009, 11:17:41 AM4/16/09
to
Thank you, Wolfgang and hanukas.
My application is structured in such a way that allows me to easily
switch from SDL, GLUT, GWFL. ( I prefer not to recompile GLUT. I can,
but I somehow feel I'm not using the right tools if I have to do
that.)
I first switched to GWFL and it worked, but then I ran across a
limiting factor in GWFL: You can hide the mouse cursor, but it remains
hidden even if the mouse leaves your window.
I then switched to SDL and everything worked fine! I can created a
fixed window size and mouse cursors are happy.

I should have listed to your advice, Wolfgang and tried SDL first...
Thank you guys!

0 new messages