CGPoint pt = [gestureRecognizer locationInView:self];
pt.y = self.bounds.size.height - pt.y;
However this calculation could be wrong if OpenGL viewport size does not match UIView size.
I tried to resize OpenGL viewport at various point to match UIView size but did not succeed. Finally I got a workaround which allows me to get the correct OpenGL window coordinates:
float viewport[4];
glGetFloatv(GL_VIEWPORT, viewport);
pt.y = (1.0f - pt.y/self.bounds.size.height) * viewport[3];
No comments:
Post a Comment