GLPaint 旋转画笔

发布于 2024-12-18 18:27:47 字数 407 浏览 5 评论 0原文

我是 OpenGL 的新手,现在我正在尝试扩展 Apple GLpaint 示例提供的并实现画笔旋转。 我发现了以下代码,我尝试在 PaintingView 的 renderLineFromPoint:toPoint: 方法(GLpaint 示例)中应用很多不同的方法,其中“角度”是梯度值(例如 45),

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.5,0.5,0.0);
glRotatef(angle,0.0,0.0,1.0);
glTranslatef(-0.5,-0.5,0.0);
glMatrixMode(GL_MODELVIEW); 

但不是旋转画笔,它旋转了该方法必须描画的整条线。 如何正确应用 glRotatef() 才能仅旋转画笔?

I am new in OpenGl and right now I am trying to extend provided by Apple GLpaint example and implement brush rotating.
I have found following code, which I have tried to apply a lot of different ways inside renderLineFromPoint:toPoint: method of PaintingView (GLpaint example), where 'angle' is value in grad (45 for example)

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.5,0.5,0.0);
glRotatef(angle,0.0,0.0,1.0);
glTranslatef(-0.5,-0.5,0.0);
glMatrixMode(GL_MODELVIEW); 

but instead of rotating the brush, it has rotated the whole line which this method have to stroke.
How glRotatef() have to be properly applied in order rotate just the brush?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文