GLPaint 旋转画笔
我是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论