4,449
社区成员
发帖
与我相关
我的任务
分享
#ifdef _WIN32
#include <windows.h>
#endif
#include <assert.h>
#include <iostream>
#include <math.h>
#if 0
#include <GL/gl.h>
#else
#include <GL/glew.h>
#endif
#include <GL/glut.h>
#include <stdlib.h>
float angleX = 2.0;
float angle = 2.0, deltaAngle = 1.0;
float red=1.0, blue=1.0, green=1.0;
float width,height;
int specialKey;
//draw circle
const int n = 20;
const GLfloat R = 0.5f;
const GLfloat Pi = 3.1415926536f;
void JShape(GLsizei w,GLsizei h)
{
glClearColor(1.0,1.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0,800,0,800);
}
void Primitives(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,0,0);
glBegin(GL_LINES);
glVertex2i(800,15);
glVertex2i(10,800);
glEnd();
glFlush();
// glutSwapBuffers();
}
void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowPosition(80,80);
glutInitWindowSize(800,800);
glutCreateWindow("FIVE PIMITIVES");
glutDisplayFunc(Primitives);
glutReshapeFunc(JShape);
glutMainLoop();
}