Why isn't this working? Can someone point me in the right direction?
rem setup screen
sync on
sync rate 60
backdrop on
color backdrop 0
hide mouse
rem global variables
global mem as byte
global mesh as word
global x as integer
global y as integer
global t as integer
global n as integer
global x# as float
global y# as float
rem set variables
obj=1
resx=50
resy=50
f_texobj=obj
f_resx=resx
f_resy=resy
rem find a free memblock
for mem=1 to 255
if memblock exist(mem)=0 then exit
next mem
rem find a free mesh
for mesh=1 to 65535
if mesh exist(mesh)=0 then exit
next mesh
rem create a memblock for distortion mesh
make memblock mem,resx*resy*216+12
rem write header data
write memblock dword mem,0,338 : rem FVF format
write memblock dword mem,4,36 : rem bytes per vertex
write memblock dword mem,8,resx*resy*6 : rem vertex count
rem generate mesh
n=12
for x=1 to resx
for y=1 to resy
for t=1 to 6
x#=x+(t=2)+(t=3)+(t=5)
y#=y+(t=3)+(t=5)+(t=6)
write memblock float mem,n+0,x#
write memblock float mem,n+4,y#
write memblock float mem,n+8,0
write memblock float mem,n+12,0
write memblock float mem,n+16,0
write memblock float mem,n+20,-1
write memblock dword mem,n+24,0xFFFFFFFF
write memblock float mem,n+28,x#/resx
write memblock float mem,n+22,y#/resy
inc n,36
next t
next y
next x
rem create a simple texture
create bitmap 1,64,64
a2fillbox 0,0,63,63,0xFF00FF00
a2circle 31,31,31,0xFFFFFF00
get image 1,0,0,64,64
delete bitmap 1
rem create object
make mesh from memblock mesh,mem
make object f_texobj,mesh,1
set object f_texobj,1,0,0
rem main loop
position camera 25,25,-80
point camera 25,25,0
do
rem refresh screen
sync
rem end of main loop
loop
The plain should display the image generated (a yellow circle on a blue background), but all I get are some very strange color gradients...
TheComet