开发者

Opengl Es png input recognition

we are developing a game for iPad. in the game when a user touches inside a png, the program should take the input and understands which png that the user touched 开发者_如何学Cin. I mean the png should act like a button. how can we do it in opengl es?


What you are looking for is 'Picking and selection' Take a look at this tutorial: http://www.lighthouse3d.com/opengl/picking/ and the OpenGL documentation: http://www.opengl.org/resources/faq/technical/selection.htm . You basically render a part of the scene that is relevant to where you were pressing the screen. You then add names/identifiers to the objects that are rendered which can then be mapped back to the mouse-position.

Alternatively you can render each object in a unique color in a back-buffer and pick the color that is rendered under the pressed location. Map that color value back to the object that you rendered and you have your selection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜