Sehubungan dengan Tugas yang diberikan, maka kami akan membagikan hasil tugas kami, yaitu membuat kotak dengan Basic4GL.
Inilah Source Code Kotak :
sub Square(x0#,y0#,z0#,x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#)
glBegin(GL_QUADS)
glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0)
glVertex3f(x0#,y0#,z0#) : glVertex3f(x1#,y1#,z1#) : glVertex3f(x2#,y2#,z2#) : glVertex3f(x3#,y3#,z3#)
glEnd()
end sub
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) ' Clear The Screen And The Depth Buffer
glLoadIdentity() ' Reset The View
glTranslatef(0,0,-10)
'glRotatef(90,1,0,0)
'Square(-1,1,0,3,3,0,-3,1,0,1,3,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(3,3,0,1,3,0,1,1,0,3,1,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(-3,3,0,-1,3,0,-1,1,0,-3,1,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(-1,1,0,-1,-1,0,1,-1,0,1,1,0)
SwapBuffers()
Jika Di Running, hasilnya akan seperti berikut :
sub Square(x0#,y0#,z0#,x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#)
glBegin(GL_QUADS)
glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0) : glColor3f(1.0,0.0,0.0)
glVertex3f(x0#,y0#,z0#) : glVertex3f(x1#,y1#,z1#) : glVertex3f(x2#,y2#,z2#) : glVertex3f(x3#,y3#,z3#)
glEnd()
end sub
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) ' Clear The Screen And The Depth Buffer
glLoadIdentity() ' Reset The View
glTranslatef(0,0,-10)
'glRotatef(90,1,0,0)
'Square(-1,1,0,3,3,0,-3,1,0,1,3,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(3,3,0,1,3,0,1,1,0,3,1,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(-3,3,0,-1,3,0,-1,1,0,-3,1,0)
glRotatef(45,0,1,0)
glTranslatef(1,0,0)
Square(-1,1,0,-1,-1,0,1,-1,0,1,1,0)
SwapBuffers()
Jika Di Running, hasilnya akan seperti berikut :
Tidak ada komentar:
Posting Komentar