协调与OpenGL ES 2.0的采摘 [英] Coordinate Picking with OpenGL ES 2.0

查看:350
本文介绍了协调与OpenGL ES 2.0的采摘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图实现与OpenGL ES 2.0的一个坐标的拾取功能。
我无法实现这两个版本我已​​经在我的桌面版本中实现。

i try to implement a coordinate picking function with OpenGL ES 2.0. I cannot implement the two versions i've implemented in my desktop version.

版1是使每三角形中一个独特的颜色,从而重新present三角形的指数比来计算与一个光线投射的坐标。此版本不工作,因为在OpenGL ES的GLSL 1.0版是没有变的GL_PrimitiveID移位运算也是不可能的。

Version 1 is to render every triangle in a unique color, which represent the index of the triangle and than to calculate the coordinate with an raycast. This version doesn't work, because in the OpenGL ES GLSL Version 1.0 is no variable GL_PrimitiveID an bitwise shifting is also not possible.

2版是呈现坐标作为浮点纹理的值,但浮点纹理中未提供的OpenGL ES 2.0

Version 2 is to render the coordinate as the value of a floating-point texture, but floating-point texture is not available in OpenGL ES 2.0.

有没有人又知道我可以实现?我不想光线投射每一个三角形,因为它不是那么高性能的。

Has anybody another idea what I can implement? I don't want to raycast every triangle, because it's not so performant.

感谢您的帮助和任何想法。

Thanks for help and any ideas.

推荐答案

实施坐标采摘另一种方式是对象的光采摘。它被认为是接从2D屏幕坐标的3D对象的最佳方法。你不必渲染场景物体的独特的颜色和挑选颜色来确定交集。

Another way to implement picking of coordinates is ray picking of objects. It is considered to be the best method to pick 3D objects from 2D screen coordinates. You won't have to render scene with unique colors of objects and pick colors to determine intersection.

我已经实现采摘与这个伟大的教程的帮助对象:
http://android-raypick.blogspot.com/2012/04/first-i-want-to-state-this-is-my-first.html

I've implemented picking of 3D objects with the help of this great tutorial: http://android-raypick.blogspot.com/2012/04/first-i-want-to-state-this-is-my-first.html

算法的一些优化之后(我做的博客文章评论)的表现并不在我的案件的问题。为了测试性能,我采摘与3000+三角形的3D模型,这是快。在现实情况下,碰撞检测,你可以使用模型非常简单的几何体。

After some optimizations of algorithm (I've made a comment in blog post) performance is not an issue in my case. To test performance I'm picking a 3D model with 3000+ triangles and it is fast. In real cases, for collision detection you can use models with very simplified geometry.

这篇关于协调与OpenGL ES 2.0的采摘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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