After discovering the joys of memblocks, i've made a better one. Not only are memblocks hellaciously fast, you can also make images with alpha. This should illustrate.
Credit for the rgba function goes to Aaron Miller. His snippet is here:
http://forum.thegamecreators.com/?m=forum_view&t=113560&b=6
#constant temp_memblocknum 1 `change this to something else if you are in the middle of using memblock 1 for other stuff
sync on:sync rate 60
autocam off
backdrop on:color backdrop rgb(100,100,100)
`MAKE SOME IMAGES
single_pixel_image(1,255,0,0,255) `opaque red
single_pixel_image(2,255,0,0,128) `mid opacity red
single_pixel_image(3,255,255,0,128) `mid opacity yellow
single_pixel_image(4,0,0,255,64) `feint blue
for c=1 to 4
make object cube c,1.5:texture object c,c
position object c,0,0,2*c-4
set object transparency c,2 `transparency needs to be on (not 0)
`flag 1 doesn't seem to work right because it draws in order of images, so
`you can't see image 4 behind images 1 2 or 3, you can't see 3 behind 1 or 2 etc.
`flag 2 seems to work OK
next c
do
position camera 0,0,0
yrot=wrapvalue(yrot+leftkey()-rightkey())
rotate camera 10,yrot,0
move camera -8
if spacekey() then set alpha mapping on 3,50 else set alpha mapping on 3,100
`illustrates that resultant texture is not just with alpha channel set to 50%- it multiplies original alpha- this is cool news!
sync
loop
end
function single_pixel_image(imagenum,red,green,blue,alpha)
make memblock temp_memblocknum,16
write memblock dword temp_memblocknum,0,1
write memblock dword temp_memblocknum,4,1
write memblock dword temp_memblocknum,8,32
write memblock dword temp_memblocknum,12,rgba(red,green,blue,alpha)
make image from memblock imagenum,1
delete memblock temp_memblocknum
endfunction
`RGBA function by Aaron Miller
function rgba(r,g,b,a)
c = (a and 0xff) << 24 or ((r and 0xff) << 16) or ((g and 0xff) << 8) or (b and 0xff)
endfunction c