我正在使用OpenGL ES 2.0开发Android应用程序并遇到一个问题,即每当我尝试放大或缩小图像时,它都会进行缩放,但应用程序响应非常缓慢并最终崩溃而没有错误消息。缩放手势事件通过我的GLSurfaceView类的onTouchEvent(MotionEvent e)方法处理:
@Override
public boolean onTouchEvent(MotionEvent e) {
mScaleDetector.onTouchEvent(e);
if (!mScaleDetector.isInProgress()){
mRenderer.processTouchEvent(e);}//touchstate being what happens when a touch event occurs
return true;
}
以下是比例监听器类:
public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
public boolean onScale(ScaleGestureDetector detector) {
AppFragment.scaleFactor *= detector.getScaleFactor();
// Don't let the object get too small or too large.
AppFragment.scaleFactor = Math.max(1f, Math.min(AppFragment.scaleFactor, 10.0f));
AppFragment.xFocus=detector.getFocusX();
AppFragment.yFocus=detector.getFocusY();
AppFragment.HAS_BEEN_MAGNIFIED=true;
AppFragment.mGLSurfaceView.requestRender();
return true;
}
}
对于可能导致此问题的任何建议将不胜感激。