Thursday, May 23, 2013

flow chart untuk koding di bawah ini


sub DADA(x0,y0,x1,y1)
        dim dx,dy
    dim step#,i
    dim xinc,yinc
    dim x
    dim y
    glBegin(GL_POINTS)
 
    dy=y1-y0
    dx=x1-x0
    x=x0
    y=y0
 
   if Abs(dx)>Abs(dy) then step#=Abs(dx) else step#=Abs(dy)  endif
    xinc=dx/step#
    yinc=dy/step#

    glVertex3f(Abs(x), Abs(y),0)

    for i = 0 to step#
    i=i+1
            x=x+xinc
            y=y+yinc
            glVertex3f(Abs(x), Abs(y),0)
     next
 
        glEnd()
                                   
end sub
 
sub DADA_DOT(x0,y0,x1,y1)
    dim dx,dy
    dim step#,i
    dim xinc,yinc
    dim x
    dim y
    glBegin(GL_POINTS)
 
    dy=y1-y0
    dx=x1-x0
    x=x0
    y=y0
 
   if Abs(dx)>Abs(dy) then step#=Abs(dx) else step#=Abs(dy)  endif
    xinc=dx/step#
    yinc=dy/step#

    glVertex3f(Abs(x), Abs(y),0)

    for i = 0 to step#
    i=i+1
            x=x+xinc
            y=y+yinc
           if i % 5=0 then glVertex3f(Abs(x), Abs(y),0) endif
     next
 
        glEnd()
                                   
end sub
 
sub DADA_SRET(x0,y0,x1,y1)
    dim dx,dy
    dim step#,i
    dim xinc,yinc
    dim x
    dim y
    dim z#=0
    glBegin(GL_POINTS)
 
    dy=y1-y0
    dx=x1-x0
    x=x0
    y=y0
 
   if Abs(dx)>Abs(dy) then step#=Abs(dx) else step#=Abs(dy)  endif
    xinc=dx/step#
    yinc=dy/step#

    glVertex3f(Abs(x), Abs(y),0)

    for i = 0 to step#
    i=i+1
            x=x+xinc
            y=y+yinc
            if z#=0 then glVertex3f(Abs(x), Abs(y),0) endif
           if i % 5=0 then
             if z#=0 then z#=1 else z#=0 endif
       endif
     next
        glEnd()
                                   
end sub
 
sub DADA_DOT_SRET(x0,y0,x1,y1)
    dim dx,dy
    dim step#,i
    dim xinc,yinc
    dim x
    dim y
    dim z#=0
    glBegin(GL_POINTS)
 
    dy=y1-y0
    dx=x1-x0
    x=x0
    y=y0
 
   if Abs(dx)>Abs(dy) then step#=Abs(dx) else step#=Abs(dy)  endif
    xinc=dx/step#
    yinc=dy/step#

    glVertex3f(Abs(x), Abs(y),0)

    for i = 0 to step#
    i=i+1
            x=x+xinc
            y=y+yinc  
      if i % 3=0 then glVertex3f(Abs(x), Abs(y),0)
         else
         if z#=0 then glVertex3f(Abs(x), Abs(y),0) endif
       
         if i % 5=0 then
             if z#=0 then z#=1 else z#=0 endif
          endif
       endif
     next
        glEnd()
                                     '
end sub

while true
 glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)    
 const XSize = 640, YSize = 480
 glMatrixMode (GL_PROJECTION)
 glLoadIdentity ()
 glOrtho (0, XSize, YSize, 0, 0, 1)
 glDisable(GL_DEPTH_TEST)
 glMatrixMode (GL_MODELVIEW)
 glLoadIdentity()
 glTranslatef(0.375, 0.375, 0)
       DADA_DOT_SRET(10,40,1000,40)  
       DADA_SRET(10,30,1000,30)
       DADA_DOT(10,20,1000,20)
       DADA(10,10,1000,10)
    SwapBuffers ()
wend



flow chart nya

flow chart by Nevan Seneng Ngadem