Sign in to follow this  
Maverick Programmer

Disabling Resize Screen, Setting Mouse , Glut

Recommended Posts

Main topics are in Bold, rest are in-depth Are there any functions or ways to disable my window from be re-sized, or at least getting the new size from being re-sized in Glut? What I'm talking about is the boarder of an application, in Glut you are able to click and resize/stretch at will. How do you disable that? Also, are there any functions or ways to set the mouse position in Glut?. I need the solutions to be cross-platform hopefully using GLut solely. No windows functions. Thank you all.

Share this post


Link to post
Share on other sites
1. void glutReshapeWindow(int width, int height);

I have never used this so Im not sure if it forces a call to the resize callback function, but if it does then you will want to wrap this in an if statement inside of your resize function since this is where you would want to call this from (you dont want it going into an infinite resize callback loop).

[edit] AFAIK i dont think theres a way to get a handle on the mouse to specifically set its position (is there a specific reason you want to do this?). There are simple funcitons to determine where the mouse is however: Mouse Funcs

Share this post


Link to post
Share on other sites
1) I'll try that and see what I get.
2) I'm building a FPS, and my mouseHandle() function relies on the subtraction of the mouse coordinates to rotate the camera [look up or down/ left or right]. This works, but the mouse will leave the screen or hit the border and I need the mouse to change positions so my function can work properly. Thanks in advance.

Share this post


Link to post
Share on other sites
You could always use that mouse glutEntryFunc function to determine if your mouse leaves the window and "pause" the game till it returns into focus... but im sure thats no where near ideal.

Share this post


Link to post
Share on other sites
glutReshapeFunc(NULL)

or in the function pointer, set the values to glViewPort() to be the values you want for height and width.

glutWarpPointer(width /2, height / 2)

and maybe glutSetCursor(GLUT_NONE) or glutSetCursor(GLUT_FULL_CROSSHAIR) depending on tastes and support.

Jamie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this