View Full Version : How to Rotate 3D Object
01-19-2010, 10:15 PM
i am new to opengl,
i have 3 doubts
1. i want to rotate the 3D Object based on the mouse move
2. i want to zoom in /out controlled by mouse scroll wheel
3 i want to draw plane,cylinder,cone,circle in 3d plane(not XY OR YZ OR XZ PLANE)
01-19-2010, 11:21 PM
For point 1 look for arcball rotation.
With arcball rotation a virtual sphere is placed around the object. If you click in the window, the vector from the center of the sphere towards the surface of the sphere where you clicked with your mouse is calculated. While dragging with your mouse a second vector from the center to the surface (new location of the mouse) is calculated. With these two vectors you can calculate a normal vector, this is the vector around which you are rotating. The angle is the angle between the two vectors. Search google for more details of implementation.
Point 2: just apply a transformation when you are rotating the scrollwheel.
If you are unsure how to get input, have a look at SDL for example. Or glut will do the job as well.
02-04-2010, 01:25 AM
i want to Draw Point,line ,point,Cylinder,Circle,cone,sphere from the user input(get the input from the user in the dialog box value in vc++) and draw it not predefined program values
how to do the above?
my program consists of rorate,zoom option also
So Please help me and give me the sample project link or give me the code for how to do the above
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.