检测 iPhone 中 openGLES 3dbox 中触摸哪一侧
我正在开发一个项目,其中包含一个 3d 框,该框通过用户触摸进行旋转,并在单击一侧时打开相关页面。每一侧都有指向另一个视图的链接,因此我需要知道在程序上单击了哪一侧。
我在我的应用程序中使用 Brad Larson 的精彩示例,我可以通过触摸旋转立方体,感谢他的代码和时间。
(代码链接在这里:从哪里启动 openGL ES 在 iPhone 中创建和旋转立方体?)
现在我需要知道如何检测在盒子上单击了哪一侧。通常我开发基于视图的应用程序,我真的不知道 openGL 或类似的东西。
我搜索了该网站,但找不到一个好的答案(至少我可以用我的 opengl 知识理解一些东西)
PS:这里是来自 Brad Larson 的 3dCube 代码: http://www.sunsetlakesoftware.com/sites/default/files/CubeExample.zip
i am working on a project that contains a 3d box that rotated by user touch and opens revelant page when clicked on a side. each side has link to another view so i need to know which side is clicked on the program.
i am using Brad Larson's wonderfull example in my app and i can rotate the cube with touch, thanx to his code and time.
( the code is linked in here: Where to start openGL ES to create and rotate a cube in an iPhone? )
now i need to know how to detect whick side is clicked on the box. normally i develop view based applications, i really have no idea on openGL or things like that.
i've searched the site but couldnt find a good answer (at least something that i can understand with my opengl knowledge)
P.S: Here, the 3dCube code from Brad Larson: http://www.sunsetlakesoftware.com/sites/default/files/CubeExample.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下这里:http://www.3dkingdoms.com/selection.html
在 OpenGL 中世界上,我认为他们将此称为“采摘”。实用函数 gluunproject 将为您提供帮助。对于立方体来说,将拾取光线与模型的面相交应该不难。
Take a look here: http://www.3dkingdoms.com/selection.html
In the OpenGL world, I think they refer to this as "picking". The utility function gluunproject will help you. Intersecting the picking ray with your model's faces should not be hard for a cube.