开发者

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

开发者 https://www.devze.com 2023-03-02 18:34 出处:网络
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 th

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 anysi开发者_Go百科mple 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号