const XSize = 640, YSize = 480 glMatrixMode (GL_PROJECTION) glLoadIdentity () glOrtho (0, XSize, YSize, 0, 0, 1) glDisable(GL_DEPTH_TEST) glMatrixMode (GL_MODELVIEW) glLoadIdentity() ' Displacement trick for exact pixelization glTranslatef(0.375, 0.375, 0) ' Variables dim angle#, x1, x2, x3, x4, y1, y2, y3, y4 dim i dim switch ' Draw a scene glClearColor(.3, .3, .3, 0) for i = 1 to 400 x1 = i gosub piksel next for i = 1 to 100 x2 = x2+4 y2 = 15 gosub piksel next for i = 1 to 600 switch=switch+1 if switch<=1 then x3 = x3+9 y3 = 30 endif if switch>=20 then x3 = x3+1 y3 = 30 endif if switch=30 then switch=0 endif gosub piksel next for i = 1 to 300 switch=switch+1 if switch<=3 then x4 = x4+9 y4 = 45 endif if switch>=20 then x4 = x4+1 endif if switch=25 then switch=0 endif gosub piksel next SwapBuffers() End piksel: glBegin(GL_POINTS) glVertex2f(x1 + 100, y1 +150) glVertex2f(x2 + 100, y2 +150) glVertex2f(x3 + 100, y3 +150) glVertex2f(x4 + 100, y4 +150) glEnd() return
Rabu, 16 Juli 2014
Membuat 4 garis dengan titik Basic4gl
Posting kali ini mengenai membuat 4 garis dengan pembangkitan titik titik menggunakan basic4gl. Dan source code nya seperti berikut :
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar