Membuat Bangun Jajargenjang 2D - Pemrograman Grafik
#include <GL/glut.h>
void renderScene(void)
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f (-0.7f, -0.3f);
glVertex2f (-0.3f, 0.3f);
glVertex2f (0.7f, 0.3f);
glVertex2f (0.3f, -0.3f);
glColor3f (1.0, 0.5, 0.0);
glEnd();
glFlush();
}
int main(int argc, char* argv[])
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Bangun Jajar Genjang");
glutInitWindowPosition(200, 200);
glutInitWindowSize(400,400);
glutDisplayFunc (renderScene);
glutMainLoop();
return 0;
}
void renderScene(void)
{
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f (-0.7f, -0.3f);
glVertex2f (-0.3f, 0.3f);
glVertex2f (0.7f, 0.3f);
glVertex2f (0.3f, -0.3f);
glColor3f (1.0, 0.5, 0.0);
glEnd();
glFlush();
}
int main(int argc, char* argv[])
{
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Bangun Jajar Genjang");
glutInitWindowPosition(200, 200);
glutInitWindowSize(400,400);
glutDisplayFunc (renderScene);
glutMainLoop();
return 0;
}
Komentar
Posting Komentar