PDA

View Full Version : co-ordinates etc.



incredible_hulk
07-22-2001, 08:53 AM
Hi,

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:
http://www-users.york.ac.uk/~jrm117/opengl/horiz_gui.c

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
James

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.

DFrey
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.

incredible_hulk
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"????
Cheers,
James

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




glutCreateWindow(title);

hWnd=FindWindow("GLUT",title);
SetWindowLong(hWnd,GWL_STYLE,WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX |WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);

// work around to force non-client area to be resized
ShowWindow(hWnd,SW_MINIMIZE);
ShowWindow(hWnd,SW_SHOW);



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....

robert_s
12-07-2001, 01: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?