import math
from OpenGL.GL import *
from OpenGL.GLUT import *
def myDisplay():
glClear(GL_COLOR_BUFFER_BIT)
glBegin(GL_POLYGON)
n=200
R=0.5
pi= math.pi
for i in range (n):
glVertex2f(R*math.cos(2*pi/n*i),R*math.sin(2*pi/n*i))
glEnd();
glFlush();
glutInit();
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("Test");
glutDisplayFunc(myDisplay);
glutMainLoop();
OpenGL-绘制一个圆
最新推荐文章于 2023-10-03 13:08:16 发布