흐이애 2014. 10. 1. 11:12

/*#include <gl/glut.h>

void init() {}
void MyDisplay(void) {
 glClearColor (1.0, 0.0, 0.0, 0.0);
 glClear (GL_COLOR_BUFFER_BIT);
 glColor3f (1.0, 1.0, 0.0);
 glBegin(GL_TRIANGLES);
 glVertex2f (0.0, 0.0);
 glVertex2f (0.75, 0.25);
 glVertex2f (0.42, 0.6);
 glEnd();
 glFlush();
}

int main(int argc, char** argv) {
 glutInit(&argc,argv);
 glutInitDisplayMode(GLUT_RGBA);
 glutInitWindowSize(500,300);
 glutCreateWindow("OpenGL Sample Drawing");
 init();
 glutDisplayFunc(MyDisplay);
 glutMainLoop();
 return 0;
}*/

#include <gl/glut.h>

void init(void)
{
 glClearColor(0.7, 0.7, 0.0, 1.0);
}
void MyDisplay()
{
 glClear(GL_COLOR_BUFFER_BIT);
 glColor3f(0.3, 0.0, 0.0);
 glBegin(GL_TRIANGLES);
 glVertex2f(0.0, 0.7);
 glVertex2f(-0.3, -0.5);
 glVertex2f(0.45, 0.0);
 glEnd();
 glFlush();
}

int main(int argc, char** argv)
{
 glutInit(&argc, argv);
 glutInitDisplayMode(GLUT_RGBA);
 glutInitWindowSize(500, 300);
 glutCreateWindow("OpenGL Sample Drawing");
 init();
 glutDisplayFunc(MyDisplay);
 glutMainLoop();
 return 0;
}

반응형