Try and add the following to the framework code:
' add to the color of a pixel in the image buffer
Method setPixelAdditive(x:Int,y:Int,r:Byte,g:Byte,b:Byte,a:Byte=255)
Local pixPtr:Byte Ptr = PixmapPixelPtr(Self.buffer)
If x > -1 And x < Self.width And y > -1 And y < Self.height Then
Local offset:Int = y*Self.pitch+x*Self.bcount
If r + pixPtr[offset] > 255 Then
pixPtr[offset] = 255
Else
pixPtr[offset] :+ r
End If
If g + pixPtr[offset+1] > 255 Then
pixPtr[offset+1] = 255
Else
pixPtr[offset+1] :+ g
End If
If b + pixPtr[offset+2] > 255 Then
pixPtr[offset+2] = 255
Else
pixPtr[offset+2] :+ b
End If
If Self.bcount = 4 Then
If a + pixPtr[offset+3] > 255 Then
pixPtr[offset+3] = 255
Else
pixPtr[offset+3] :+ a
End If
End If
End If
End Method
Then try something like this:
SuperStrict
Framework BRL.GLMax2D
Import BRL.Pixmap
Import BRL.PNGLoader
Import BRL.Random
Import BRL.Retro
SetGraphicsDriver GLMax2DDriver()
Include "E:\zSoftwareRenderFramework\zSoftwareRenderFramework_v05.bmx"
Graphics 640,480
Global timerUpd:Int = MilliSecs()
Global timerFrq:Int = 1000/30 ' 30 fps
Global screenBuffer:zImageBuffer = zImageBuffer.make(640,480)
While Not KeyHit(KEY_ESCAPE)
Cls
screenBuffer.drawToScreen()
Flip
While MilliSecs() < timerUpd+timerFrq
Wend
timerUpd = MilliSecs()
additiveLine(screenBuffer,Rnd(0,320),Rnd(0,240),Rnd(320,640),Rnd(240,480),32,64,32)
Wend
End
Function additiveLine(buf:zImageBuffer,x1:Float,y1:Float,x2:Float,y2:Float,r:Byte,g:Byte,b:Byte,a:Byte=255)
Local r2:Byte = r/2,g2:Byte = g/2,b2:Byte = b/2
Local steps:Float,xI:Float,i:Int
x2 :- x1
y2 :- y1
If Abs(x2) > Abs(y2) Then
steps = Abs(x2)
Else
steps = Abs(y2)
End If
xI = Float(x2 / steps)
y2 = Float(y2 / steps)
For x2 = 0 To steps
buf.setPixelAdditive(Int(x1)-1,Int(y1),r2,g2,b2,a)
buf.setPixelAdditive(Int(x1)+1,Int(y1),r2,g2,b2,a)
buf.setPixelAdditive(Int(x1),Int(y1),r,g,b,a)
buf.setPixelAdditive(Int(x1),Int(y1)-1,r2,g2,b2,a)
buf.setPixelAdditive(Int(x1),Int(y1)+2,r2,g2,b2,a)
x1 :+ xI
y1 :+ y2
Next
End Function
You will have to change the include path to where you have stored the software render framework file.
Is that somewhat like the effect you are after?