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
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
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-
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
hope it helps
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement