View Full Version : Mouse click to zoom on object

12-16-2017, 05:58 AM
Hey guys,im just learning OpenGL, i make our solar system with modern OpenGl, i wanna make the planet zoom in when i click it with mouse but i stuck there, can anyone help me?

* sry for my bad english

12-17-2017, 06:18 AM
This is a very tricky matter on any 3d application where all 3 axis are used in order to represent when a mouse is at. You have many options at this point. 1 create an image of the environment at that time and test for colors within the plane ( This was actually a very useful tool especially during the 8 bit operations of the NES - see Duck Hunt for examples ). You can triangulate the direction behind the mouse and test for objects within that spacing. Or you can assign an (bottom,left,top,right) screen coordinate system for the objects in the solar system that approximate with screen x,y. The latter will probably be the most versatile but representing the x,y in pixels will be effected drastically by the monitor size and resolution settings so it is imperative that you designate it by system. I forget the exact process but if I do remember correctly it can be tied into the FOV system to get the values correctly.