This is slow:
200ms on my 3.2GHz P4, ATI 9800XT, 1Gb RAM.
If I change the last parameter of CreateImage to 2, it's 0ms. This is because the image held is on the videocard not in memory and thus it can be destroyed by Alt+Tabbing so this is not useful.
Can anyone thing of a quicker way to grab the backbuffer into a managed image? Btw I've tried locking it and reading the pixels with ReadPixelFast in a loop, but it's amost exactly the same speed!
I also tried this:
Wondering if I could fool it. Notice the first image is dynamic and the second image is managed. This appears to give a very fast time. Wooo I thought until I alt+tabbed and discovered that the second image is now dyanmic too. Basically Copy image ignores the original flag state of the image (1) and actually copies the image in video memory (flag=2). This is practically a bug! What if you wanted to make a managed image in memory from an image grabbed in video RAM? You'd have to read each pixel out and copy it "manually", lame.
Thanks in advance.
w=800 h=640 Graphics w,h,32,2 stT = MilliSecs() grab = CreateImage(w, h, 1, 1) GrabImage(grab, 0, 0) EndT = MilliSecs() - stT Text 0,0,EndT + "ms" Flip WaitKey
200ms on my 3.2GHz P4, ATI 9800XT, 1Gb RAM.
If I change the last parameter of CreateImage to 2, it's 0ms. This is because the image held is on the videocard not in memory and thus it can be destroyed by Alt+Tabbing so this is not useful.
Can anyone thing of a quicker way to grab the backbuffer into a managed image? Btw I've tried locking it and reading the pixels with ReadPixelFast in a loop, but it's amost exactly the same speed!
I also tried this:
w=800 h=640 Graphics w,h,32,2 stT = MilliSecs() grab = CreateImage(w, h, 1, 2) second = CreateImage(w, h, 1, 1) GrabImage(grab, 0, 0) second = CopyImage(grab) EndT = MilliSecs() - stT Text 0,0,EndT + "ms" Flip WaitKey
Wondering if I could fool it. Notice the first image is dynamic and the second image is managed. This appears to give a very fast time. Wooo I thought until I alt+tabbed and discovered that the second image is now dyanmic too. Basically Copy image ignores the original flag state of the image (1) and actually copies the image in video memory (flag=2). This is practically a bug! What if you wanted to make a managed image in memory from an image grabbed in video RAM? You'd have to read each pixel out and copy it "manually", lame.
Thanks in advance.