0

嗨,我的程序应该在屏幕中心显示一个纯红色的球体,我得到的只是球体的边界:

int main(int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
  glutInitWindowSize(800,600); 
  glutInitWindowPosition(0,0);
  glutCreateWindow("Sphere");

  glutDisplayFunc(renderScene);
  glutReshapeFunc(changeSize);
  glutMainLoop();

  return 0;
}


void renderScene() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glColor3f(1.0f,0.0f,0.0f);

  glutSolidSphere(2.5, 50, 40);

  glutSwapBuffers();
}
4

2 回答 2

1

尝试glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);在你之前添加glutSolidSphere(2.5, 50, 40);

于 2010-10-21T07:44:22.070 回答
0

“边界”是什么意思?

实心并不意味着填充,这意味着表面不包含开口。glutWireSphere这与只是线框形成对比。

于 2010-10-21T07:41:38.957 回答