//Nim : 5302410027
//Rombel : 01
#include <GL/glut.h>
void renderScene(void); // rendering function
int main(int argc, char* argv[])
{
// init GLUT dan buat window
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutCreateWindow("Glut:)");
glutDisplayFunc(renderScene); // register callbacks
glutMainLoop(); // enter GLUT event processing cycle
return 0;
}
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POLYGON); //glBegin(menerima 1 argument)
glVertex2f(-1.5f, -1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-1.5f, -0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-0.5f, -0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-0.5f, -1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glEnd();
glBegin(GL_POLYGON); //glBegin(menerima 1 argument)
glVertex2f(-1.5f, 0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-1.5f, 1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-0.5f, 1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(-0.5f, 0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glEnd();
glBegin(GL_POLYGON); //glBegin(menerima 1 argument)
glVertex2f(0.5f, 0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(0.5f, 1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(1.5f, 1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(1.5f, 0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glEnd();
glBegin(GL_POLYGON); //glBegin(menerima 1 argument)
glVertex2f(0.5f, -1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(0.5f, -0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(1.5f, -0.5f); //void glVertex2f(GLfloat x, GLfloat y)
glVertex2f(1.5f, -1.5f); //void glVertex2f(GLfloat x, GLfloat y)
glEnd();
glFlush();
}
Tidak ada komentar:
Posting Komentar