Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GLFW/glfw3.h>
- #include <stdlib.h>
- #include <stdio.h>
- static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
- {
- if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
- glfwSetWindowShouldClose(window, GL_TRUE); // close program on ESC key
- }
- void setup_viewport(GLFWwindow* window)
- {
- // setting viewports size, projection etc
- float ratio;
- int width, height;
- glfwGetFramebufferSize(window, &width, &height);
- ratio = width / (float) height;
- glViewport(0, 0, width, height);
- glClear(GL_COLOR_BUFFER_BIT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0,500, 0 , 500, 1.f, -1.f);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- void display()
- {
- // your drawing code here, maybe
- //glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
- //anti-aliasing
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
- glEnable(GL_POINT_SMOOTH);
- //kotak putih
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- glVertex3f(0.f, 500.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(500.f, 500.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(500.f, 0.f, 0.f);
- //glColor3f(1.f, 0.f, 0.f);
- glVertex3f(0.f, 0.f, 0.f);
- glEnd();
- /*
- //garis bantu
- //vertikal
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(250.f, 0.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(250.f, 500.f, 0.f);
- glEnd();
- //horizontal
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(0.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(500.f, 250.f, 0.f);
- glEnd();
- //horizontal 1/4
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(0.f, 125.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(500.f, 125.f, 0.f);
- glEnd();
- //horizontal 3/4
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(0.f, 375, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(500.f, 375.f, 0.f);
- glEnd();
- //vertikal 1/4
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(125.f, 0.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(125.f, 500.f, 0.f);
- glEnd();
- //vertikal 3/4
- glBegin(GL_LINE_LOOP);
- glColor3ub(230,230,230);
- glVertex3f(375.f, 0.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(375.f, 500.f, 0.f);
- glEnd();
- */
- //front plateside (green)
- glBegin(GL_POLYGON);
- glColor3ub(161,199,84);
- glVertex3f(0.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 85.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 65.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(0.f, 230.f, 0.f);
- glEnd();
- //front plateside (l.brown)
- glBegin(GL_POLYGON);
- glColor3ub(239,207,117);
- glVertex3f(0.f, 230.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 65.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 58.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(0.f, 223.f, 0.f);
- glEnd();
- //front plateside (d.brown)
- glBegin(GL_POLYGON);
- glColor3ub(131,58,27);
- glVertex3f(0.f, 223.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 58.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 51.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(0.f, 216.f, 0.f);
- glEnd();
- //side platside (green)
- glBegin(GL_POLYGON);
- glColor3ub(140,173,73);
- glVertex3f(285.f, 85.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 210.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 185.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 65.f, 0.f);
- glEnd();
- //side plateside (l.brown)
- glBegin(GL_POLYGON);
- glColor3ub(217,188,106);
- glVertex3f(285.f, 65.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 185.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 178.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 58.f, 0.f);
- glEnd();
- //side plateside (d.brown)
- glBegin(GL_POLYGON);
- glColor3ub(131,58,27);
- glVertex3f(285.f, 58.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 178.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 171.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 51.f, 0.f);
- glEnd();
- //green plate
- glBegin(GL_POLYGON);
- glColor3ub(186,232,92);
- glVertex3f(0.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(215.f, 375.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(490.f, 210.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(285.f, 85.f, 0.f);
- glEnd();
- //rumah front
- glBegin(GL_POLYGON);
- glColor3ub(224,219,184);
- glVertex3f(88.f, 340.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(97.f, 335.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(133.f, 344.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(173.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 285.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 224.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(88.f, 279.f, 0.f);
- glEnd();
- //rumah mid left
- glBegin(GL_POLYGON);
- glColor3ub(255,250,207);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 285.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 224.f, 0.f);
- glEnd();
- //rumah mid right
- glBegin(GL_POLYGON);
- glColor3ub(224,219,184);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 272.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 210.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 250.f, 0.f);
- glEnd();
- //rumah side
- glBegin(GL_POLYGON);
- glColor3ub(255,250,207);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 272.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(337.f, 319.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(375.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(375.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 210.f, 0.f);
- glEnd();
- //atap: segitiga kiri:
- glBegin(GL_POLYGON);
- glColor3ub(240,56,56);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(135.f, 353.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 285.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(173.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(133.f, 344.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(98.f, 335.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(88.f, 340.f, 0.f);
- glEnd();
- //atap: gelap kiri:
- glBegin(GL_POLYGON);
- glColor3ub(207,48,48);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(207.f, 410.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(255.f, 420.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(135.f, 353.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(88.f, 340.f, 0.f);
- glEnd();
- //atap: terang kiri:
- glBegin(GL_POLYGON);
- glColor3ub(255,59,59);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(135.f, 353.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(255.f, 420.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 355.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(257.f, 375.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 285.f, 0.f);
- glEnd();
- //atap: segitiga kanan
- glBegin(GL_POLYGON);
- glColor3ub(173,41,31);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(335.f, 325.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(375.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(365.f, 310.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(337.f, 319.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(315.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 272.f, 0.f);
- glEnd();
- //atap: terang kanan
- glBegin(GL_POLYGON);
- glColor3ub(255,59,59);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(262.f, 365.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(335.f, 325.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 272.f, 0.f);
- glEnd();
- //atap: gelap kanan
- glBegin(GL_POLYGON);
- glColor3ub(207,48,48);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(262.f, 365.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 355.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(375.f, 314.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(335.f, 325.f, 0.f);
- glEnd();
- //atap: bayangan kiri
- glBegin(GL_POLYGON);
- glColor3ub(207,48,48);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(257.f, 375.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(262.f, 365.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 314.f, 0.f);
- glEnd();
- //atap: bayangan kanan
- glBegin(GL_POLYGON);
- glColor3ub(173,41,41);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(257.f, 375.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 355.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(262.f, 365.f, 0.f);
- glEnd();
- //pintu
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(118.f, 315.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(142.f, 300.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(142.f, 248.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(118.f, 262.f, 0.f);
- glEnd();
- //pegangan pintu
- glBegin(GL_POLYGON);
- glColor3ub(54,54,54);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(120.f, 285.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(122.f, 283.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(122.f, 277.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(120.f, 279.f, 0.f);
- glEnd();
- //kolam: pinggir
- glBegin(GL_POLYGON);
- glColor3ub(255,250,207);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(232.f, 250.f, 0.f); //vermak
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(304.f, 210.f, 0.f); //vermak
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(255.f, 185.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(220.f, 185.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 205.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(185.f, 224.f, 0.f); //vermak
- glEnd();
- //kolam: air kiri
- glBegin(GL_POLYGON);
- glColor3ub(148,204,220);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(190.f, 223.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(230.f, 247.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(230.f, 225.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(195.f, 205.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(190.f, 208.f, 0.f);
- glEnd();
- //kolam: air kanan
- glBegin(GL_POLYGON);
- glColor3ub(157,213,229);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(230.f, 247.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(295.f, 210.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(275.f, 200.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(230.f, 225.f, 0.f);
- glEnd();
- //kolam: air tengah
- glBegin(GL_POLYGON);
- glColor3ub(163,219,235);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(230.f, 225.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(275.f, 200.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(255.f, 190.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(225.f, 190.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(195.f, 205.f, 0.f);
- glEnd();
- //bingkai jendela 1
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(148.f, 293.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(170.f, 280.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(170.f, 252.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(148.f, 265.f, 0.f);
- glEnd();
- //kaca terang jendela 1
- glBegin(GL_POLYGON);
- glColor3ub(193,241,247);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(150.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(168.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(168.f, 255.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(150.f, 267.f, 0.f);
- glEnd();
- //kaca gelap jendela 1
- glBegin(GL_POLYGON);
- glColor3ub(173,216,222);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(150.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(168.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(168.f, 255.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(150.f, 267.f, 0.f);
- glEnd();
- //bingkai jendela 2
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(238.f, 293.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(260.f, 280.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(260.f, 252.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(238.f, 265.f, 0.f);
- glEnd();
- //kaca terang jendela 2
- glBegin(GL_POLYGON);
- glColor3ub(193,241,247);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(240.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(168.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(258.f, 255.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(240.f, 267.f, 0.f);
- glEnd();
- //kaca gelap jendela 2
- glBegin(GL_POLYGON);
- glColor3ub(173,216,222);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(240.f, 290.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(258.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(258.f, 255.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(150.f, 267.f, 0.f);
- glEnd();
- //bingkai jendela 3
- glBegin(GL_POLYGON);
- //x+30, y-18
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(268.f, 275.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(290.f, 262.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(290.f, 234.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(268.f, 247.f, 0.f);
- glEnd();
- //kaca terang jendela 3
- glBegin(GL_POLYGON);
- glColor3ub(193,241,247);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(270.f, 272.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(168.f, 278.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(288.f, 237.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(270.f, 249.f, 0.f);
- glEnd();
- //kaca gelap jendela 3
- glBegin(GL_POLYGON);
- glColor3ub(173,216,222);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(270.f, 272.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(288.f, 260.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(288.f, 237.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(150.f, 267.f, 0.f);
- glEnd();
- //bingkai jendela 4
- glBegin(GL_POLYGON);
- //x+30, y-18
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(316.f, 262.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(338.f, 275.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(338.f, 247.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(316.f, 234.f, 0.f);
- glEnd();
- //kaca terang jendela 4
- glBegin(GL_POLYGON);
- glColor3ub(193,241,247);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(318.f, 260.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(336.f, 273.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(336.f, 249.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(318.f, 236.f, 0.f);
- glEnd();
- //kaca gelap jendela 4
- glBegin(GL_POLYGON);
- glColor3ub(173,216,222);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(318.f, 260.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(336.f, 272.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(318.f, 236.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- //glVertex3f(150.f, 267.f, 0.f);
- glEnd();
- //bingkai jendela 5
- glBegin(GL_POLYGON);
- //x+30, y-18
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(348.f, 278.f, 0.f); //348 (+32), 278 (+16)
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(370.f, 291.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(370.f, 263.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(348.f, 250.f, 0.f);
- glEnd();
- //kaca terang jendela 5
- glBegin(GL_POLYGON);
- glColor3ub(193,241,247);
- //glColor3f(0.f, 0.f, 1.f);
- // glVertex3f(350.f, 276.f, 0.f); //348 (+32), 278 (+16)
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(368.f, 288.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(368.f, 265.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(350.f, 252.f, 0.f);
- glEnd();
- //kaca gelap jendela 5
- glBegin(GL_POLYGON);
- glColor3ub(173,216,222);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(350.f, 276.f, 0.f); //348 (+32), 278 (+16)
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(368.f, 288.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- // glVertex3f(368.f, 265.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(350.f, 252.f, 0.f);
- glEnd();
- //lapangan panahan putih
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(356.f, 210.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(415.f, 176.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(302.f, 108.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(242.f, 145.f, 0.f);
- glEnd();
- //lapangan panahan hijau
- glBegin(GL_POLYGON);
- glColor3ub(186,232,92);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(356.f, 207.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(411.f, 176.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(302.f, 111.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(246.f, 145.f, 0.f);
- glEnd();
- //sasaran putih 1
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(390.f, 267.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(413.f, 253.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(413.f, 215.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(390.f, 230.f, 0.f);
- glEnd();
- //sasaran hitam 1
- glBegin(GL_POLYGON);
- glColor3ub(0,0,0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(393.f, 260.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(410.f, 250.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(410.f, 222.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(393.f, 232.f, 0.f);
- glEnd();
- //sasaran biru 1
- glBegin(GL_POLYGON);
- glColor3ub(16, 179, 224);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(396.f, 255.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(408.f, 248.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(408.f, 226.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(396.f, 233.f, 0.f);
- glEnd();
- //sasaran merah 1
- glBegin(GL_POLYGON);
- glColor3ub(255, 0, 0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(398.f, 251.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(406.f, 246.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(406.f, 230.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(398.f, 235.f, 0.f);
- glEnd();
- //sasaran kuning 1
- glBegin(GL_POLYGON);
- glColor3ub(247, 255, 0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(401.f, 244.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(403.f, 243.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(403.f, 236.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(401.f, 237.f, 0.f);
- glEnd();
- //sasaran coklat 1
- glBegin(GL_POLYGON);
- glColor3ub(153, 102, 51);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(413.f, 215.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(426.f, 223.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(413.f, 253.f, 0.f);
- glEnd();
- //x+38,y-23
- //sasaran putih 2
- glBegin(GL_POLYGON);
- glColor3ub(255,255,255);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(428.f, 244.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(451.f, 230.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(451.f, 192.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(428.f, 207.f, 0.f);
- glEnd();
- //sasaran hitam 2
- glBegin(GL_POLYGON);
- glColor3ub(0,0,0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(431.f, 237.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(448.f, 227.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(448.f, 199.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(431.f, 209.f, 0.f);
- glEnd();
- //sasaran biru 2
- glBegin(GL_POLYGON);
- glColor3ub(16, 179, 224);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(434.f, 232.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(446.f, 225.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(446.f, 203.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(434.f, 210.f, 0.f);
- glEnd();
- //sasaran merah 2
- glBegin(GL_POLYGON);
- glColor3ub(255, 0, 0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(436.f, 228.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(444.f, 223.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(444.f, 207.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(436.f, 212.f, 0.f);
- glEnd();
- //sasaran kuning 2
- glBegin(GL_POLYGON);
- glColor3ub(247, 255, 0);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(438.f, 221.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(441.f, 220.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(441.f, 213.f, 0.f); //+9
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(438.f, 214.f, 0.f);
- glEnd();
- //sasaran coklat 2
- glBegin(GL_POLYGON);
- glColor3ub(153, 102, 51);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(451.f, 192.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(464.f, 200.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(451.f, 230.f, 0.f);
- glEnd();
- //batu 1
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(110.f, 249.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(121.f, 242.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(110.f, 235.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(99.f, 242.f, 0.f);
- glEnd();
- //batu 2
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(87.f, 235.f, 0.f); //87,235 (-23, -14)
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(98.f, 228.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(87.f, 221.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(76.f, 228.f, 0.f);
- glEnd();
- //batu 3
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //x+23, y-14
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(110.f, 221.f, 0.f); //old: 87, 235
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(121.f, 214.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(110.f, 207.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(99.f, 214.f, 0.f);
- glEnd();
- //batu 4
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //x+23, y-14
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(133.f, 207.f, 0.f); //old: 87, 221
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(144.f, 200.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(133.f, 193.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(122.f, 200.f, 0.f);
- glEnd();
- //batu 5
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //x+23, y-14
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(156.f, 193.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(167.f, 186.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(156.f, 179.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(145.f, 186.f, 0.f);
- glEnd();
- //batu 6
- glBegin(GL_POLYGON);
- glColor3ub(179,179,179);
- //x+23, y-14
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(179.f, 179.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(190.f, 172.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(179.f, 165.f, 0.f);
- //glColor3f(0.f, 0.f, 1.f);
- glVertex3f(168.f, 172.f, 0.f);
- glEnd();
- }
- int main(void)
- {
- GLFWwindow* window;
- if (!glfwInit()) exit(EXIT_FAILURE);
- window = glfwCreateWindow(700, 700, "tugas2 - Aura Nabila Azelia (G64140043)", NULL, NULL);
- if (!window)
- {
- glfwTerminate();
- exit(EXIT_FAILURE);
- }
- glfwMakeContextCurrent(window);
- glfwSwapInterval(1);
- glfwSetKeyCallback(window, key_callback);
- while (!glfwWindowShouldClose(window))
- {
- setup_viewport(window);
- display();
- glfwSwapBuffers(window);
- glfwPollEvents();
- }
- glfwDestroyWindow(window);
- glfwTerminate();
- exit(EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement