views:

50

answers:

2

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 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();
}
A: 

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.

GMan
A: 

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

Bruce
I'm positive that glutSolidSphere sets the polygon mode to solid on its own (while glutWireSphere uses the line mode automagically).
Kos