OpenGL ES的:旋转自己周围的三维模型 [英] OpenGL ES: Rotating 3d model around itself

查看:249
本文介绍了OpenGL ES的:旋转自己周围的三维模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的OpenGL ES在iPhone上玩,我试着用手指平移旋转模型。我发现了开源应用分子,让你做到这一点,我看那个code,但公司当谈到旋转,我的一个模式,我可以旋转,只围绕一个点遥远的空间(就像是在轨道上运行的卫星,我固定的行星)。 什么任何的建议可能是错的? 以后我可以张贴code,也许点播(多线) 在大多数情况下是指分子,你可以在这里找到它分子

I'm playing with OpenGL ES on iPhone and I'm trying to rotate a model by panning with the finger. I discovered the open source app Molecules that let's you do that and I'm looking at that code, but when it comes to rotate a model of mine I'm able to rotate it only around a point distant in the space (like it was in orbit as a satellite and I am the fixed planet). Any suggestion on what can be wrong? I can post the code later , maybe on demand (many lines) For the most part refer to Molecules you can find it here MOLECULES

推荐答案

如果我没有记错的话,我认为你需要的模型转换到原点,旋转,然后再转换回起始位置,以获得效果,你所追求的。

If my memory serves me correctly, I think you need to translate the model to the origin, rotate, and then translate back to starting position to get the effect you are after.

我觉得有一个glTranslate()函数,说明对象是1,0,0。然后,通过-1,0,0翻译去的起源。即用向量从物体到原点的中心去平移。

I think there is a glTranslate() function, Say the object is at 1,0,0. You should then translate by -1,0,0 to go to origin. That is translate by a vector going from the center of the object to the origin.

这篇关于OpenGL ES的:旋转自己周围的三维模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆