开发者

How can I rotate 3-D any object with through mouse by using OpenGL?

开发者 https://www.devze.com 2023-04-04 09:07 出处:网络
How can I rotate 3-D an object with through mouse by using OpenGL?How can I do that?Could you show me开发者_如何转开发 how this is done?That\'s a lot of code to do that and it also depends on how you\

How can I rotate 3-D an object with through mouse by using OpenGL?How can I do that?Could you show me开发者_如何转开发 how this is done?


That's a lot of code to do that and it also depends on how you're rendering the object.

Are you using the fixed function pipeline or are you using shaders?

As for the mouse part, you need to handle the MouseDown, MouseMove and MouseUp methods / events the form generates. Try getting a feel for how the mouse works by just drawing a simple bitmap that can be moved using the mouse. Once you've got the hang of handling the mouse input, change the response to update the object's rotation based on the amount the mouse moved in the x/y/z axes. Try to avoid using Euler (angle) notation for the rotation of the object, use a matrix and rotate the matrix instead.

0

精彩评论

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