在 GLPaint 中倒置绘制的 CGPoints
我们正在将 GLPaint 示例用于新应用程序。 我们希望向用户演示绘制少量对象的方法。 我们看到苹果GLPaint有一个关于如何回放绘图点数据的示例。
因此,我们设法提供了我们自己的数据,除了它使数据颠倒的问题之外,它的效果很好。
当提供的点是针对该 -
时,它将绘制
有一个简单的解决方案吗?
谢谢,沙尼
We are using GLPaint example for a new app.
We wish to demonstrate the user the way to draw few objects.
We saw apple GLPaint has an example on how to playback data of points to drawings.
So we have managed to supply our own data and it works great beside the problem that it makes it upside down.
When the points supplied are for that -
it will draw that
Is there a simple solution for that?
Thanks, Shani
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢吉纳明
,帮了很多忙。
听起来他们应该制作某种内置函数来翻转坐标。
我这么做了——
1.找到y坐标的最高点和最低点。
2. 将每个 y 点乘以 -1,然后添加最高点 + 最低点。所以图像绘制正确。
如果这对任何人有帮助的话,这就是代码。
和绘图功能 -
我是编程新手,所以我希望我的代码没有问题。
有帮助
希望这对沙尼
thanks Ginamin
that helped a lot.
it sounds that they should make some kind of a build in function to flip the coordinates.
i did that -
1. find the highest and lowest point in the y coordinates.
2. multiply each y point in -1, and add the highest + lowest points to it. so the image is drawn correctly.
this is the code if it will help anyone.
and the drawing function -
im new to programming, so i hope there are no problems in my code.
hope it will help
shani
iPhone 坐标系从上到下读取,而 openGL 使用笛卡尔坐标系。因此,openGL 中的所有绘图在 iPhone 上都会颠倒显示。渲染时尝试将图像上下翻转。
The iPhone coordinate system reads up to down, while openGL uses a cartesian system. So, all drawings in openGL will appear upside down on the iPhone. Try and flip your image upside down when rendering.