项目需要实现Object Picking, 所以学习了一下OpenGL ES关于对象拾取方面的知识,由于GLES没有GL那样提供专门的拾取函数GL_SELECT,所以需要自己来写方法实现Object Picking,目前, 主要有两种方法来实现Object Picking, 一种是 Ray Casting, 中文名称叫射线拾取方法; 另一种是color Picking/Coding, 中文名称叫伪颜色拾取方法。
关于Ray Casting 的基本原理, 我希望你参考:
http://en.wikipedia.org/wiki/Ray_casting
http://stackoverflow.com/questions/6774197/opengl-es-2-0-object-picking-on-ios
http://stackoverflow.com/questions/22757816/opengl-es-2-0-object-picking-on-ios-using-color-coding
http://stackoverflow.com/questions/10312607/opengl-es-2-0-object-picking-on-ios-using-color-coding
http://ej04xjp6.blogspot.com/2012/07/opengles-with-iphone-using-color-coding.html
http://ej04xjp6.blogspot.com/2012/07/opengles-with-iphone-using-color-coding.html
当然还有一个最经典的:
http://www.lighthouse3d.com/opengl/picking/index.php?color2
上面是基本原理的出处,我暂时没时间把所有原理详细介绍了,所以你要想理解这两种Picking方法,就慢慢的看懂,当然, 如果你打不开上面的部分网站,那就要自己想办法了。
Demo下载地址: http://download.csdn.net/detail/luozhonglan/7134455
清明节快到了, 大柚要回家祭祖了, 愿老祖宗保佑我早日成为高富帅,迎娶白富美。
罗大柚OpenGL ES教程系列LessonX——Object Picking,布布扣,bubuko.com
罗大柚OpenGL ES教程系列LessonX——Object Picking
原文:http://blog.csdn.net/casablaneca/article/details/22785915