Sehubungan dengan Tugas yang diberikan, maka akan membagikan hasil tugas kami selanjutnya, yaitu membuat rotasi perputaran siklus Matahari, Bumi, Bulan, dan Planet Lain.
Inilah Source Code Rotasi :
sub Rotasi(I#)
glBegin(GL_QUADS) ' Draw a quad
'buat depan
glcolor3f(1,1,0.1)
glVertex3f(-1, 1, -1) 'A
glVertex3f( 1, 1, -1) 'B
glVertex3f( 1,-1, -1) 'C
glVertex3f(-1,-1, -1) 'D
'buat bawah
glcolor3f(0.1,1,1)
glVertex3f(-1, 1, 1) 'A
glVertex3f( 1, 1, 1) 'B
glVertex3f( 1,-1, 1) 'F
glVertex3f(-1,-1, 1) 'E
'buat sono
glcolor3f(1,1,1)
glVertex3f(-1,-1, 1) 'F
glVertex3f(-1, 1, 1) 'E
glVertex3f(-1, 1,-1) 'H
glVertex3f(-1,-1,-1) 'G
'buat atas
glcolor3f(1,0.1,1)
glVertex3f(1,-1, 1) 'H
glVertex3f(1, 1, 1) 'G
glVertex3f(1, 1,-1) 'C
glVertex3f(1,-1,-1) 'D
'kanan
glcolor3f(0.1,0.1,1)
glVertex3f(-1, 1, 1) 'B
glVertex3f( 1, 1, 1) 'F
glVertex3f( 1, 1,-1) 'G
glVertex3f(-1, 1,-1) 'C
'kiri
glcolor3f(0.1,0.5,0.1)
glVertex3f(-1,-1, 1) 'A
glVertex3f( 1,-1, 1) 'E
glVertex3f( 1,-1,-1) 'H
glVertex3f(-1,-1,-1) 'D
glEnd()
end sub
dim d# : d#=0
dim d1# : d1#=0
dim d2# : d2#=0
dim d3# : d3#=0
while true
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) ' Clear screen and depth buffer
'Matrix View Point
glLoadIdentity() ' Reset the current modelview matrix
glTranslatef(0,0.0,-50.0) ' Move left 1.5 units and into the screen 6.0
d# =d#+1
d1# =d1#-0.5
d2# =d2#+0.1
d3# =d3#+0.1
glrotatef(d3#,0,1,1)
glTranslatef(0,0,0)
Rotasi(4)
glrotatef(d2#,0,1,0)
glTranslatef(-10,0,0)
Rotasi(3)
glrotatef(d1#,0,1,0)
glTranslatef(-3,0,0)
Rotasi(2)
glrotatef(d#,0,1,0)
glTranslatef(-20,0,0)
Rotasi(1)
SwapBuffers ()
wend
Maka jika di running, hasilnya akan seperti dibawah ini :
Jika Ingin Tau Lebih Lengkapnya, Silahkan download disini
Tidak ada komentar:
Posting Komentar