OpenGL:将屏幕坐标转换为 OpenGL 坐标
我在 OpenGL ES 中绘制变化条,它有坐标 (x,y,z)。
我想在 Action_Down 上添加一些更改(例如:栏中的颜色)。有getX()
,但该方法返回以像素为单位的x坐标,而不是OpenGL中对应的坐标。是否有一些类可以将 OpenGL 坐标转换为像素?或者有什么公式可以实现吗?
I draw changing bar in OpenGL ES it has coords (x,y,z).
I would like to add some changes (example: colors in bar) on Action_Down. There is getX()
, but this method returns the x coordinate in pixels, but not corresponding coords in OpenGL. Is there some class to convert OpenGL coords to pixels? Or is there any formula for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你正在寻找这个:
http://www.opengl。 org/sdk/docs/man2/xhtml/gluProject.xml
它获取坐标并将它们映射到窗口坐标,左上角为 (0, 0)。
I think you're looking for this:
http://www.opengl.org/sdk/docs/man2/xhtml/gluProject.xml
It takes coordinates and maps them to window coordinates, with (0, 0) at the top left.