/* so this could be omitted: */
drawcircle(250,250,100);
/* and flush that buffer to the screen */
glFlush();
}
void display3() //画圆
{
glClear(GL_COLOR_BUFFER_BIT); /*clear the window */
/*----------------------------------------*/
/* viewport stuff */
/*----------------------------------------*/
/* set up a viewport in the screen window */
/* args to glViewport are left, bottom, width, height */
glViewport(0, 0, 500, 500);
/* NB: default viewport has same coords as in myinit, */
/* so this could be omitted: */
drawEllipse(250,250,60,40);
/* and flush that buffer to the screen */
glFlush();
}
int main(int argc, char** argv)
{
/* Standard GLUT initialization */
glutInit(&argc,argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); /* default, not needed */ glutInitWindowSize(500,500); /* 500 x 500 pixel window */
glutInitWindowPosition(0,0); /* place window top left on display */
cout<<"************************************************"<<endl; cout<<"**** 请选择如下操作: *****"<<endl; cout<<"**** 1.用DDA画线 *****"<<endl; cout<<"**** 2.用Bresenham算法画圆 *****"<<endl; cout<<"**** 3.用Bresenham算法画椭圆 *****"<<endl; cout<<"************************************************"<<endl; cout<<"请选择如下操作:"; int choice;