#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
void init(){
glClearColor(1.0, 1.0, 1.0, 1.0);
gluOrtho2D(-1.0,10.0,-1.0,10.0);
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(1.0,1.0);
glColor3f(1.0,1.0,0.0);
glVertex2f(4.0,8.0);
glColor3f(1.0,0.0,1.0);
glVertex2f(8.0,1.0);
glEnd();
#include <GL/glu.h>
#include <GL/glut.h>
void init(){
glClearColor(1.0, 1.0, 1.0, 1.0);
gluOrtho2D(-1.0,10.0,-1.0,10.0);
}
void display(){
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(1.0,1.0);
glColor3f(1.0,1.0,0.0);
glVertex2f(4.0,8.0);
glColor3f(1.0,0.0,1.0);
glVertex2f(8.0,1.0);
glEnd();
glFlush();
}
int main(int argc, char *argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(400, 300);
glutInitWindowPosition(200, 100);
glutCreateWindow("OpenGL Program");
glutDisplayFunc(display);
init();
glutMainLoop();
return 0;
}
No comments:
Post a Comment