Lockbuffer ->Memory access violation
Archives Forums/Blitz3D Bug Reports/Lockbuffer ->Memory access violation
| ||
on writepixelfast command, running the example:; High Speed Graphics Commands Graphics 640,480,16 ; Draw a bunch of stuff on the screen For t= 1 To 1000 Color Rnd(255),Rnd(255),Rnd(255) Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1) Next Delay 3000 ; Copy the top half of the screen over the bottom half ; using fast pixels and locked buffers For x = 1 To 640 For y = 1 To 240 LockBuffer FrontBuffer() WritePixelFast x,y+241,ReadPixelFast(x,y) UnlockBuffer FrontBuffer() Next Next Delay 3000 ; Draw the left half of the screen over the right half ; using the slower direct pixel access For x = 1 To 320 For y = 1 To 480 WritePixel x+320,y,ReadPixel(x,y) Next Next |
| ||
this way it works... it seems that the buffer starts from 0... uhm... For x = 0 To 639 For y = 0 To 239 LockBuffer FrontBuffer() ; DebugLog y+240 WritePixelFast x,y+240,ReadPixelFast(x,y) UnlockBuffer FrontBuffer() Next Next |
| ||
Fixed. |
| ||
wanna know a secret to get more speed? put your (un-)lockbuffer calls outside the loops... ^_^ |
| ||
Yes...that's the first thing I made :) However I decided to not use copypixelfast... It takes 20 fps to copy a little portion of 128x128 from backbuffer to texturebuffer I went for copyrect instead...the only problem is that I cannot fit 640x480 backbuffer to the 512x512 texture. |