Question

I try to use setRotation() on my GLSurfaceView, but the view seems not rotate around the pivot which is the center of the screen. the code like below:

class MyGLSurfaceView extends GLSurfaceView {
    private float mCurRotation = 0.0f;

    @Override
    public boolean onTouchEvent(MotionEvent e) {
        mCurRotation = mCurRotation + 10;
        setRotation(mCurRotation);
    }
}

Is there any body know the reason and teach me how to rotate my GLSurfaceView?

Was it helpful?

Solution

Contrary to your expectation, methods of View doesn't work well.

GLSurfaceView punches a hole to display underneath surface. Actually it has only transparent pixels.

If you want to rotate your image, you have to use OpenGL operations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top