[英]Can someone tell me why I get an OpenGL stack underflow?
I wrote this code:我写了这段代码:
void drawWinningScreen(GL10 gl) {
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
font.setTopColor(1, 1, 0);
font.setBottomColor(1, 0, 0);
font.spaceString("You win", 0f, 0f, .7f, .7f, -0.15f, gl);
gl.glPopMatrix();
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glPopMatrix();
int error = gl.glGetError();
}
I think it should work, but it seems to be causing a stack underflow somewhere.我认为它应该可以工作,但它似乎在某处导致堆栈下溢。
I figured it out.我想到了。 It was because the method has the side effect of setting the matrix mode to GL_PROJECTION.
这是因为该方法具有将矩阵模式设置为 GL_PROJECTION 的副作用。 Code after it was expecting the matrix mode to be GL_MODELVIEW.
期望矩阵模式为 GL_MODELVIEW 之后的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.