I am showing 2D Image on GLSurfaceView and Want to rotate it with specific degree (ie. 180 ,75,360...)
I written following code in touch event.( Here GPUImageView extends GLSurfaceView ) and I am getting value in variable rotationDegree from my Rotate Gesture Detector class which process two finger rotation gestures. Below code rotate the GLSufaceview but content / iamge shown in GLSurfaceView remain same (not rotating inside it). android have examples but they are for 3D and not rotation with degree.
@Override
public boolean onTouchEvent(MotionEvent event)
{
rotationDetector.onTouchEvent(event);
/* Rotate View Here */
GPUImageView.this.setRotation(rotationDegree);
requestRender();
return true;
}
I have my custom rotation detector class which dispatches events related to two finger rotation
private class RotateListener extends RotateGestureDetector.SimpleOnRotateGestureListener
{
@Override
public boolean onRotate(RotateGestureDetector detector)
{
rotationDegree -= detector.getRotationDegreesDelta();
return true;
}
}
rotationDegree
? Within the code you have shown for this particular function it is constant. – Andon M. Coleman