Halo semua, balik lagi nih dengan saya. Kali ini saya akan memberikan contoh source code untuk pembuatan gambar objek berbentuk hati, yaitu sebagai berikut : Source Code : from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * import numpy as np def init(): glClearColor(0.0, 0.0, 0.0, 0.0) gluOrtho2D(-2.0, 2.0, -2.0, 2.0) def plotpoints(): glClear(GL_COLOR_BUFFER_BIT) glColor3f(0.0, 1.0, 0.0) glPointSize(13) glBegin(GL_LINES) glVertex2f(-500, 0) glVertex2f(500, 0) #glColor3f digunakan sebagai warna garis horizontal dan vertical yang tertera pada screen capture glVertex2f(0, -500) glVertex2f(0, 500) glEnd() heart_shape() glFlush() def heart_shape(): glBegin(GL_LINE_STRIP) glColor3f(0.0, 1.0, 0.0) x = -1.139 #digunakan untuk fill gambar, disini saya memakai warna hijau while(x <= 1.139): delta = np.cbrt(x*x) * np.sqrt(x*x) - 4*x*x + 4 y1 = (np.cbrt(x*x) + np.sqrt(delta...