I'm trying simply to display an openGL surface when I click the screen using GLSurfaceView.RENDERMODE_WHEN_DIRTY mode
but the surface does not display when I click it , why ?
my Activity :
public class ViewManager extends Activity {
private GLSurfaceView surfaceView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
surfaceView = new GLSurfaceView(this);
surfaceView.setEGLContextClientVersion(2);
surfaceView.setRenderer(new MyRenderer());
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
surfaceView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event!=null){
if (event.getAction()==MotionEvent.ACTION_DOWN)
surfaceView.requestRender();
return true;
}else{
return false;
}
}
});
}
@Override
protected void onResume() {
super.onResume();
surfaceView.onResume();
}
@Override
protected void onPause() {
super.onPause();
surfaceView.onPause();
}
}