this is a test i made:
.lib "kernel32.dll"
apiRtlMoveMemory(Destination*,Source,Length):"RtlMoveMemory"
apiRtlMoveMemory2(Destination,Source*,Length):"RtlMoveMemory"
Const gw = 1024
Const gh = 768
Const gw1 = gw - 1
Const gh1 = gh - 1
Const gw2 = gw / 2 - 1
Const gw21 = gw / 2
Graphics gw, gh, 32, 2
SetBuffer BackBuffer()
bnkVideo = CreateBank(gw * gh * 4)
w4 = gw * 4
start = MilliSecs()
For i = 1 To 30
For x = 0 To gw2
For y = 0 To gh1
PokeInt bnkVideo, y * w4 + x * 4, $00FF00
Next
Next
Next
LockBuffer()
bnkInfo = CreateBank(32)
apiRtlMoveMemory bnkInfo, GraphicsBuffer() + 72, 32
size = PeekInt(bnkInfo, 20) * PeekInt(bnkInfo, 24) * PeekInt(bnkInfo, 28) / 8
If BankSize(bnkVideo) < size Or PeekInt(bnkInfo, 0) = 0 Then
FreeBank bnkInfo
RuntimeError "Failed to draw on buffer."
Else
apiRtlMoveMemory2 PeekInt(bnkInfo, 0), bnkVideo, size
FreeBank bnkInfo
EndIf
UnlockBuffer()
time1 = MilliSecs() - start
LockBuffer()
start = MilliSecs()
For i = 1 To 30
For x = gw21 To gw1
For y = 0 To gh1
WritePixelFast x, y, $FF0000
Next
Next
Next
time2 = MilliSecs() - start
UnlockBuffer()
Text 10, 10, "Poke: " + time1
Text gw2 + 10, 10, "WritePixelFast: " + time2
Flip
WaitKey()
End
on my machine, writepixelfast is 4 times faster on high resolutions...
why ain't i just writing >>DIRECTLY<< to the backbuffer? i mean - this code is modifyed of the link above
so on some machines the poke method is faster and on some machines the pixel method is faster. also on high resolutions the writepixel method is faster...