#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math.h> #include <stdio.h> void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); glPointSize(5.0f); //修改点的尺寸,默认大小为1.0f glBegin(GL_POINTS); glVertex2f(0.0f, 0.0f); glVertex2f(0.5f, 0.5f); glVertex2f(-0.5f, 0.0f); glEnd(); glFlush(); } int main(int argc, char *argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); glutInitWindowPosition(100, 100); glutInitWindowSize(500, 500); glutCreateWindow("OpenGL画圆程序"); glutDisplayFunc(&myDisplay); glutMainLoop(); return 0; }
运行结果: