Advertisement

GLUT

Started by January 06, 2001 05:03 PM
5 comments, last by lokapujya 23 years, 10 months ago
what''s the difference between Nehe base code and say the glutmainloop() code? i came across this when i was trying to add Dinput code to one of my glut based programs and couldn''t figure out how to do it. also the reason i wanted to use glut is because its easy to make popup menus. is there a way to make such a menu without it? it''''s all about a good time! -LOKAPUJA-
it's all about a good time!AOLIM name: -LOKAPUJA-
Well..

Glut is like a wrapper you can use when coding opengl.
so you can create windows, resize them,read keyboard/mouseinput and do all kinds of windows stuff without using those API calls to the OS.. or well of course they are made, but you just let glut do it for you.

So this is probably why you can get DirectInput to work..
you should take a look at the functions
glKeyboardCallback
and
glMouseCallback

if you really wanna use glut...

the cool part about glut is, that its much easier to port across platforms..
i have never had to rewrite any code when i have used glut, it just ran smoothly from one platform to another.


Nehe''s code is using OpenGL and the real windows API calls



Jonas Meyer Rasmussenmeyer@diku.dk
Advertisement
thanks for the info,
i wanted to use the glutMainLoop but use directinput for reading mouse position, but there is probably a way to read the mouse position with glut. I didn''t think to look for that. If i find anything i''ll post it here.

it''''s all about a good time!


-LOKAPUJA-
it's all about a good time!AOLIM name: -LOKAPUJA-
Here are the two functions you need.
Taken from the opengl programmers guide, Appendix D
quote:
void glutMouseFunc(void (*func)(int button, int state, int x, int y));
Specifies the function, func, that''s called when a mouse button is pressed or released. The button callback parameter is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON. The state callback parameter is either GLUT_UP or GLUT_DOWN, depending upon whether the mouse has been released or pressed. The x and y callback parameters indicate the location (in window-relative coordinates) of the mouse when the event occurred.

void glutMotionFunc(void (*func)(int x, int y));
Specifies the function, func, that''s called when the mouse pointer moves within the window while one or more mouse buttons is pressed. The x and y callback parameters indicate the location (in window-relative coordinates) of the mouse when the event occurred.


hope it helps
Jonas Meyer Rasmussenmeyer@diku.dk
where can i get GLUT?
http://reality.sgi.com/opengl/glut3/glut3.html
Advertisement
here''s a good tutorial, it covers everything you need to know about:

http://www.fatech.com/tech/opengl/glut/index.php3?1

This topic is closed to new replies.

Advertisement