gishara
gishara

Reputation: 845

How to allow the user to zoom and rotate 3D objects in Opengl and Visual C++

I am new to opengl and visual c++. I have done a sample application which rotates 3D shapes in opengl. I want to allow the user to rotate and zoom the object. Please give me an example of how to do this.

I have tried NeHe tutorial: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48

I can't understand the class structure in the example. Is there anysimple way to achieve this?

I have found a library as well: http://www.nigels.com/glt/gltzpr/

But still can't figure out how to do this. Please help me.

Upvotes: 0

Views: 7937

Answers (1)

Joel Falcou
Joel Falcou

Reputation: 6357

Zooming is usually done through gluLookAt. The third parameter is the view distance. Here is some basic example running this :

http://graphics.stanford.edu/courses/cs248-01/OpenGLHelpSession/code_example.html

Look in display() to see how the viewing distance is used and in MouseMotion() to see how the value is modified and the painting updated.

Upvotes: 1

Related Questions