GL stack underflow happens at glPopMatrix();
I can't figure out the problem I have.. But I just guess push & pop Matrix...
I know Popping the stack with nothing on it can occur 'stack underflow... but I don't think I got that problem.. please give me an answer!
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glPushMatrix();
gl.glScalef(1f, 1f, 1f);
gl.glTranslatef(0f, 0f, 0f);
gl.glMatrixMode(GL10.GL_TEXTURE);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, bgScroll1,0.0f);
background.draw(gl);
gl.glPopMatrix(); //stack underflow happens at this line
The GL maintains a seprate matrix stack for each matrix type:
GL_MODELVIEW
,GL_PROJECTION
, adnGL_TEXTURE
. The push/pop matrix operations always work on the current matrix mode (as all matrix-related GL commands). So your code pushes on the modelview stack, and tries to pop from the texture matrix stack, which probably is empty.You should set the matrix mode back to
GL_MODELVIEW
after you modified the texture matrix.