Basic mouse movement

Hi all,

Really sorry for the newbie ness of this question. I’ve tried over the weekend to add the ability to use the mouse to ‘move’. I believe it’s the ‘viewport’, which is a ‘component’ of the frustrum. Is my terminology correct? Basically, I’m tired of rendering my objects in weird places and would like to add ‘standard’ code to my test/learning projects that allows me to use the mouse to move my viewport. As I said, I tried over the weekend with little or no success! I’m too new at this! Plotting points is ok, working out co-ordinates in 3D space is ok, but making the viewport move with the mouse, hmmm … still got a lot to learn! Anway, it should probably record the current position with the WM_MOUSEMOVE message, and work out differences so it can add to or subtract from the X and Y co-ords. Also, I’d like to use the mouse scroller to move in z co-ord. Anyone have simple to use/understand and implement code?

PS: I’ve done a search, with limited/no relevant results!



First of all I’d recommend getting familiar with nehe productions ( Secondly, I’d say to make life very easy, either use the Nehe base code for making quick OpenGL applications, or get ClanLib ( Currently, ClanLib’s webpage is in search of a new home, so until they get the new page up, you won’t be able to get it (but check in later on - it’s worth it).

Lastly, here is a direct link to OpenGL and mouse movement (some is quake-style).

Happy coding.


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.