Segitiga 3D
Berikut source code yang digunakan : from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * piramida_1 = 0 piramida_2 = 0 def init (): glClearColor( 0.5 , 0.5 , 0.5 , 0.5 ) glEnable(GL_DEPTH_TEST) gluOrtho2D(- 20.0 , 20.0 , - 20.0 , 20.0 ) def myDisplay (): global piramida_1, piramida_2 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glTranslatef( 0 , 0 , - 7.0 ) ; glRotatef( piramida_1, 1.0 , 0.0 , 0.0 ) glRotatef( piramida_2, 0.0 , 1.0 , 0.0 ) glBegin(GL_QUADS) # Bagian alas segitiga atau piramida (y = -1.0) glColor3f( 0.0 , 1.0 , 1.0 ); glVertex3f( 1.0 , - 1.0 , 1.0 ) ; glVertex3f(- 1.0 , - 1.0 , 1.0 ) ; glVertex3f(- 1.0 , - 1.0 , - 1.0 ) ; glVertex3f( 1.0 , - 1.0 , - 1.0 ) ; glEnd() ; glBegin(GL_TRIANGLES) # Bagian Depan Piramida atau front face (z = 1.0) glColor3f( 1.0 , 0.0 , 0.5 ); glVertex3f( 1.0 , - 1.0 , 1.0 ) ; glVer...