How to detect the area of touch in open gl es in android?

左心房为你撑大大i 提交于 2019-12-08 11:25:56

问题


I have designed a 3D model in .obj format and imported using min3d framework. Its a cube with different colors. I want to give a Toast with a message for a particular color when the side of that particular color is touched. How do I do this in android 1.6 ?


回答1:


I'm not sure about the particulars in android/OpenGL-es, but in general:

You have to calculate a line that starts at the camera's position and passes through the screen coordinate pressed/clicked/etc and determine where that line intersects your object.

It's called... ah yes: "picking". Googling for "opengl picking" turned up a tutorial or three:

http://www.lighthouse3d.com/opengl/picking/

http://gpwiki.org/index.php/OpenGL:Tutorials:Picking ...

I just googled "opengl picking". Those two are the first two links, the next is a FAQ entry, followed by another tutorial. You get the idea.

Once you know what its called, finding information gets much easier. Good hunting.



来源:https://stackoverflow.com/questions/3942230/how-to-detect-the-area-of-touch-in-open-gl-es-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!