Jump to content
  • Advertisement
Sign in to follow this  
Vorel512

iOS multi-touch problem

This topic is 2305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi experts!

I am using:
- xCode 4.3.1
- OpenGLES 2.0

I have encountered a problem, and do not find any clear solution.
I've set up multitouch methods and they are working fine except the the given positions are wrong.


.
.
.
GLKView *view = (GLKView *)self.view;
view.context = self.context;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
view.multipleTouchEnabled = true;
.
.
.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSSet *allTouches = [event allTouches];
UITouch *touch = [[UITouch alloc] init];
CGPoint currentTouch;

NSLog(@"---------");
NSLog(@"at:%d",[allTouches count]);

for (int nTouch = 0; nTouch < [allTouches count]; nTouch++)
{
touch = [[allTouches allObjects] objectAtIndex:nTouch];
currentTouch = [touch locationInView:[touch view]];
NSLog(@"x:%f y:%f", currentTouch.x, currentTouch.y);
}
}


The first touch is ok, but the others are not,and they gave me positions like the first one, or very similar.
On the net I've find documents and posts, that maybe I need other layers than [touch view], but I do not know if it is true or not, and how to do that in OpenGLES.

Any answers are welcome!!!

Share this post


Link to post
Share on other sites
Advertisement
Okay, I've found out, that touches is only enabled in OpenGL view, so I should pass that view to the touch locationInView.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!