【发布时间】:2012-08-03 13:32:55
【问题描述】:
我是 opengles 的新手,我创建了 EAGLView 类代码如下 我在 EAGLView 类中添加了以下方法
- (void)updateScene:(CGPoint)delta {
float f=delta.x;
NSLog(@"%f",f);
glLoadIdentity();
glPushMatrix();
glTranslatef(f,0.0, 0.0);
glPopMatrix();
/////////
}
我想在用户触摸屏幕时移动对象,触摸方法的代码在下面给出,在控制器中
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.eaglView];
[eaglView updateScene:touchLocation];
}
【问题讨论】:
-
请阅读这篇文章,这也是你未来 gl 问题的答案: 点击here