Dominic Grenier
Dominic Grenier

Reputation: 357

Why doesn't onSurfaceCreated ever run in this code?

I create my game element this way in my activity:

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mGame = new Game(this);
  mGame.bootstrap();
  setContentView(CommonObject.sCommonParams.touch);
  mGame.loadTextures();
}

Then in my bootstrap I create my GLsurfaceView this way: (callingActivity is the this I passed when I created mGame)

CommonObject.sCommonParams.openGLView = new GLSurfaceView(callingActivity);
CommonObject.sCommonParams.openGLView.setRenderer(new GameRenderer());
CommonObject.sCommonParams.openGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

Is it because I pass GLSurfaceView to a static object that it's not working?

Upvotes: 0

Views: 258

Answers (1)

Dominic Grenier
Dominic Grenier

Reputation: 357

Turns out I had to

setContentView(CommonObject.sCommonParams.openGLView);

for onSurfaceCreated to run. Which is sad since I was trying to avoid doing that.

Upvotes: 1

Related Questions