I can't get this to work (Additive Blend function)

Blitz3D Forums/Blitz3D Beginners Area/I can't get this to work (Additive Blend function)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Can anybody help me figure out what the problem is? I've tried this with both TextureBuffers and ImageBuffers. Neither seems to work. I can load and display the images individually by copying them to the backbuffer, but when I call the function, it just produces a black box.

I'm still very new at this and I wrote this code without a firm experience-based understanding of what each command does, just the info I've read in the Blitz3D command reference. So probabaly, one of the commands I used doesn't do what I think it does.

If anyone can explain what the problem is, or can make this work, please let me know.

Thanks in advance for any helpful replies. :)

Graphics3D 800,600,16,0
camera=CreateCamera()

Global Target= CreateImage(64,64)
Global Source1= LoadImage("tex1.bmp")
Global Source2= LoadImage("tex2.bmp")

AddBlend(Source1,Source2,Target)

Repeat
Mil1=MilliSecs() 
UpdateWorld
RenderWorld
SetBuffer BackBuffer()
CopyRect 0,0,64,64,0,0,ImageBuffer(Target),BackBuffer() 
Mil2= MilliSecs() 
Color 255,255,0
Text 4,500,"Render time: "+(Mil2-Mil1)
Flip
Until KeyDown(1)

Function AddBlend(SourceTexture1,SourceTexture2,TargetTexture)
  For x = 0 To 64
    For y = 0 To 64
      SetBuffer ImageBuffer(SourceTexture1)
      GetColor x,y
      r1#=ColorRed
      g1#=ColorGreen
      b1#=ColorBlue
      SetBuffer ImageBuffer(SourceTexture2)
      GetColor x,y
      r2#=ColorRed
      g2#=ColorGreen     
      b2#=ColorBlue
      SetBuffer ImageBuffer(TargetTexture)
      Color r1#+r2#,g1#+g2#,b1#+b2#
      Plot x,y
    Next
  Next
End Function