开发者

GlutSolidSphere not solid

Hi my program is supposed to display a solid red colored sphere in the center of the screen, all i am getting is the boundary of the sphere :

int main(int ar开发者_如何学编程gc, 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();
}


Try adding glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); before your glutSolidSphere(2.5, 50, 40);


What do you mean "boundary"?

Solid doesn't mean filled, it means the surface contains no openings. This is in contrast to glutWireSphere, which is just the wire frame.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜