简体   繁体   English

我在哪里可以找到响应触摸的iPhone OpenGL ES示例?

[英]Where can I find an iPhone OpenGL ES Example that responds to touch?

I would like to find an iPhone OpenGL ES Example that responds to touch. 我想找一个响应触摸的iPhone OpenGL ES示例。 Ideally it would meet these requirements: 理想情况下它会满足这些要求:

  • Displays a 3D object in the center of the screen like a cube 像立方体一样在屏幕中心显示3D对象
  • Maps a texture to the cube surfaces 将纹理映射到立方体曲面
  • Should move the camera around the cube as you drag your finger 拖动手指时,应将相机移动到立方体周围
  • Should zoom the camera in and out on the cube by pinching 应该通过挤压将相机放大和缩小到立方体上
  • Optionally has a background behind the cube that wraps around the back of the camera.(for example this could create the effect of the cube being in space) 可选择在立方体后面有一个背景,包裹着相机的背面。(例如,这可能会产生立方体在空间中的效果)

Has anyone seen one or more examples that can do these or at least render the cube with the texture? 有没有人看过一个或多个可以做这些或者至少用纹理渲染立方体的例子?

My iPhone application Molecules has its source code available via a BSD license. 我的iPhone应用程序Molecules 的源代码可通过BSD许可证获得。 It uses OpenGL ES to render a molecular structure, using single touches to rotate the structure, a pinch gesture for zooming, and simultaneous movement of two fingers for panning across the molecule. 它使用OpenGL ES渲染分子结构,使用单个触摸旋转结构,缩放手势用于缩放,以及两个手指同时移动以在整个分子上平移。 Unfortunately, it does not yet use textures for any of the rendering it does. 不幸的是,它还没有使用纹理进行任何渲染。

I document some of the things I've learned about OpenGL ES from it here and here . 在这里这里记录了我从中学到的关于OpenGL ES的一些知识。

Sounds like you're looking for more than one example: 听起来你正在寻找不止一个例子:

  1. The XCode template "OpenGL ES Application" does this. XCode模板“OpenGL ES Application”就是这样做的。
  2. This NeHe for iPhone tutorial texture maps a cube. 这个NeHe for iPhone教程纹理映射了一个立方体。
  3. For this you need the arcball algorithm . 为此,您需要arcball算法 Thanks, NeHe. 谢谢,嘿。
  4. Why not place your scene inside a texture mapped cylinder? 为什么不将场景放在纹理映射圆柱体内?
    Once again, NeHe to the rescue. 再次, NeHe来救援。 Does that guy ever sleep!?! 那个人会睡觉吗??!

You're welcome! 别客气!

对于响应触摸事件的示例OpenGL ES代码,请查看Apple的GLPaint示例代码。

I haven't found example code for this exact task, but here's a tutorial about the iPhone touch API . 我还没有找到这个确切任务的示例代码,但这里有一个关于iPhone touch API的教程。 Using the code from there, you should be able to react on touch events. 使用那里的代码,您应该能够对触摸事件做出反应。 For the graphics, look at this site that contains various OpenGL ES examples. 对于图形,请查看包含各种OpenGL ES示例的此站点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM