Post by Scott brosious on Jul 12, 2004 9:46:38 GMT -5
const width = 640, height = 480
const xmax = 100, ymax = 100
dim red(xmax)(ymax)
dim green(xmax)(ymax)
dim blue(xmax)(ymax)
dim i,j
dim x#,y#
dim choice
dim xscale#,yscale#
dim s
for j = 1 to ymax
for i = 1 to xmax
choice = int(rnd() % 7) + 1
if choice = 1 then red(i)(j) = 1: green(i)(j) = 0: blue(i)(j) = 0: endif
if choice = 2 then red(i)(j) = 0: green(i)(j) = 1: blue(i)(j) = 0: endif
if choice = 3 then red(i)(j) = 0: green(i)(j) = 0: blue(i)(j) = 1: endif
if choice = 4 then red(i)(j) = 1: green(i)(j) = 1: blue(i)(j) = 0: endif
if choice = 5 then red(i)(j) = 0: green(i)(j) = 1: blue(i)(j) = 1: endif
if choice = 6 then red(i)(j) = 1: green(i)(j) = 0: blue(i)(j) = 1: endif
if choice = 7 then red(i)(j) = 1: green(i)(j) = 1: blue(i)(j) = 1: endif
next
next
' Set 2D mode
glMatrixMode (GL_PROJECTION)
glLoadIdentity ()
glOrtho (0, width, 0, height, -1, 1)
glMatrixMode (GL_MODELVIEW)
glDisable (GL_DEPTH_TEST)
xscale# = 1
yscale# = 1
s = 0
while true
x# = 0
y# = 0
' Clear screen
glClear (GL_COLOR_BUFFER_BIT)
glDrawBuffer(GL_BACK)
' Plot some pixels
glBegin (GL_POINTS)
for j = 1 to ymax
for i = 1 to xmax
glColor3f (red(i)(j),green(i)(j),blue(i)(j))
glVertex2f (x#,y#)
x# = x# + .1
next
x# = 0
y# = y# + .1
next
glEnd ()
glReadBuffer(GL_BACK)
glRasterPos2f((width /2) - (xscale# * 5),(height /2) - (yscale# * 5))
glPixelZoom(xscale#,yscale#)
glCopyPixels(0,0,xmax,ymax,GL_COLOR)
' Display output
SwapBuffers ()
if s = 0 then xscale# = xscale# + 1: yscale# = yscale# + 1 endif
if s = 1 then xscale# = xscale# - 1: yscale# = yscale# - 1 endif
if xscale# < 1 and yscale# < 1 then s = 0 endif
if xscale# > 30 and yscale# > 30 then s = 1 endif
wend
const xmax = 100, ymax = 100
dim red(xmax)(ymax)
dim green(xmax)(ymax)
dim blue(xmax)(ymax)
dim i,j
dim x#,y#
dim choice
dim xscale#,yscale#
dim s
for j = 1 to ymax
for i = 1 to xmax
choice = int(rnd() % 7) + 1
if choice = 1 then red(i)(j) = 1: green(i)(j) = 0: blue(i)(j) = 0: endif
if choice = 2 then red(i)(j) = 0: green(i)(j) = 1: blue(i)(j) = 0: endif
if choice = 3 then red(i)(j) = 0: green(i)(j) = 0: blue(i)(j) = 1: endif
if choice = 4 then red(i)(j) = 1: green(i)(j) = 1: blue(i)(j) = 0: endif
if choice = 5 then red(i)(j) = 0: green(i)(j) = 1: blue(i)(j) = 1: endif
if choice = 6 then red(i)(j) = 1: green(i)(j) = 0: blue(i)(j) = 1: endif
if choice = 7 then red(i)(j) = 1: green(i)(j) = 1: blue(i)(j) = 1: endif
next
next
' Set 2D mode
glMatrixMode (GL_PROJECTION)
glLoadIdentity ()
glOrtho (0, width, 0, height, -1, 1)
glMatrixMode (GL_MODELVIEW)
glDisable (GL_DEPTH_TEST)
xscale# = 1
yscale# = 1
s = 0
while true
x# = 0
y# = 0
' Clear screen
glClear (GL_COLOR_BUFFER_BIT)
glDrawBuffer(GL_BACK)
' Plot some pixels
glBegin (GL_POINTS)
for j = 1 to ymax
for i = 1 to xmax
glColor3f (red(i)(j),green(i)(j),blue(i)(j))
glVertex2f (x#,y#)
x# = x# + .1
next
x# = 0
y# = y# + .1
next
glEnd ()
glReadBuffer(GL_BACK)
glRasterPos2f((width /2) - (xscale# * 5),(height /2) - (yscale# * 5))
glPixelZoom(xscale#,yscale#)
glCopyPixels(0,0,xmax,ymax,GL_COLOR)
' Display output
SwapBuffers ()
if s = 0 then xscale# = xscale# + 1: yscale# = yscale# + 1 endif
if s = 1 then xscale# = xscale# - 1: yscale# = yscale# - 1 endif
if xscale# < 1 and yscale# < 1 then s = 0 endif
if xscale# > 30 and yscale# > 30 then s = 1 endif
wend