I'm trying to create a GLSurfaceView that displays a map of a game area. When the player moves, the game activity calls highlightSpot, which in turn should trigger a render request. The only time I want to re-draw the view is when the player moves.

However, with my current implementation, despite calling setRenderMode(RENDERMODE_WHEN_DIRTY) on my GLSurfaceView, its render mode still seems to be continuous. To check, I threw a single println statement in my onDrawFrame method, and when I run my application, the output quickly fills up my logcat without the player moving even once-- it's clearly not behaving as I intended. Is there something else I need to do in order to make the view render only when asked?

(The bulk of this code is derived from the tutorials at http://insanitydesign.com/wp/projects/nehe-android-ports/. I omitted my onDrawFrame, OnSurfaceChanged, and onSurfaceCreated methods for the sake of conciseness, as I am not changing the render mode or requesting a render anywhere in those methods. If someone thinks it might be relevant, I can post those too.)

public class SurfaceViewClass extends GLSurfaceView implements Renderer {
    public SurfaceViewClass(Context context) {
        super(context);

        ...

        this.setRenderer(this);
        this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    }

    public void highlightSpot(int x, int y) {
        /* change some variables here */
        ...

        this.requestRender();
    }
}
Edit
Report