View Full Version : co-ordinates etc.

07-22-2001, 08:53 AM

As a newcomer to OpenGL I'm having difficulty in understanding how co-ordinate systems are specified... I've read up a bit about viewports and clipping volumes, etc. but this seems just to make everything more confusing! I think what I'm trying to do would be easier if I could open a window (using GLUT) that could NOT be resized - is this possible? How, for example, can I define each axis as spanning from, say, -1.0 to 2.0, so that the middle of the 3d space is at 0.5, 0.5, 0.5?

What I'm trying to do is position a point on the circumference of a circle (also made up of points) using mouse input. I've set up mouse, entry, and motion callbacks in GLUT, but can't work out how the mouse coordinates returned by GLUT (which are screen co-ordinates as far as I can tell) can be related to the co-ordinates used for describing GL vertices... Can anybody help me with this?

The code I'm using at the moment, if it helps, can be viewed at:

While I'm here, I might as well also ask another question related to this kind of mouse control... I'd like to position the point on the circumference of the circle under mouse control - this would involve working out the angle between zero-degrees on the circumference of the circle and the mouse pointer. Does anyone have any idea how I could achieve this in code?!

Thanks in advance for any help http://www.opengl.org/discussion_boards/ubb/smile.gif

07-22-2001, 11:43 AM
No, I do not think that you can have a GLUT window that can not be resized. You can make your resize code return to the old size. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

For the mouse coords check out gluUnProject.

07-22-2001, 12:08 PM
Actually, you can have a GLUT window that can not be resized. You just have to reset the style of the window.

07-22-2001, 12:11 PM
Thanks for your help y'all... I'll check out gluUnProject. BTW, how do you "reset the style of the window"????

07-22-2001, 12:51 PM
I've used something like this before:



// work around to force non-client area to be resized

Of course this is only for Windows.

[This message has been edited by DFrey (edited 07-22-2001).]

Rob The Bloke
07-22-2001, 02:47 PM
in glut, to set the size of the window use,

glutReshapeWindow( int width, int height);

place this in your reshape callback and the window will remain the same size....

12-07-2001, 12:18 PM
ok thx!! glutReshapeWindow(..) works fine! it goes back to prevoius size after eg. stretching the window but.. I want to completely disable resizing. There should be some method to do it. Just like in windows!
Any other ideas?