-3
当生成地形时,我的程序在启动程序时并没有响应。我如何解决我的程序没有响应?
这是代码。我相信这是for循环。
Random Random = new Random();
int numberHeight = Random.nextInt(5);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glColor3f(0.5f,0.5f,1.0f);
int Bottom = Height - 100;
for(int xOffset = 0; xOffset < Width; xOffset = xOffset + 100){
for(int currentHeight = 0; currentHeight < numberHeight; currentHeight = currentHeight++){
GL11.glBegin(GL11.GL_QUADS);
{
GL11.glVertex2f(xOffset,Bottom - currentHeight * 100);
GL11.glVertex2f(xOffset + 100,Bottom - currentHeight * 100);
GL11.glVertex2f(xOffset + 100,Bottom - currentHeight * 100 - 100);
GL11.glVertex2f(xOffset,Bottom - currentHeight * 100 - 100);
}
GL11.glEnd();
if(currentHeight >= numberHeight)break;
}
}
你会得到什么样的例外?并在哪一行? – honk 2014-09-06 19:13:14
寻求调试帮助的问题(“**为什么不是这个代码工作?”)必须包含所需的行为,特定的问题或错误以及在问题本身**中重现**所需的最短代码。没有**明确问题陈述**的问题对其他读者没有用处。请参见[如何创建最小,完整和可验证示例](http://stackoverflow.com/help/mcve)。 – DavidPostill 2014-09-06 20:02:25
我认为问题必须是可能使立方体超出边界的for循环。 – ZaneGlitch 2014-09-07 06:56:43