Sceen capture is slow using GetFrontBuffer

Started by
8 comments, last by hserver 14 years, 2 months ago
Hi I want to capture my Directx8 screen and do some "Image Processing" on it . i'm using pDev->GetFrontBuffer(surf) to access screen pixels but this is quite slow , any idea to make it faster?
Advertisement
Have you considered making the image processing in a pixel shader? Of course, not everything can be done that way, but if it could, it would probably be super-fast.
tom I want to know how many (for example White) pixels exist in my screen
So Simple !
Do You Think It could be done using dx8 shaders?
What about capture my window using GDI?
Hm I don't think you can count the number of specific pixels using a pixel shader.

Anyway, sorry but I don't know anything about DX8, I started with DX9.


And - what do you mean by "quite slow"?
it take about 3 or 4 sec in my pc too get front buffer and it takes so long too process about 700 frames
You would need to use a pixel shader. Iterating over the entire image in the CPU is going take take way to long. If this is somehting thats got to run at 30 FPS it would be impossible on the CPU.
You would need to use a pixel shader. Iterating over the entire image in the CPU is going take take way to long. If this is somehting thats got to run at 30 FPS it would be impossible on the CPU.
But can you count the number of lets say white pixels using a pixel shader? I cannot imagine(*) how this could be done in a pixel shader.


(*) Doesn't mean it cannot be done, nobody knows everything :D
How about using an occlusion query? That'll tell you how many pixels are drawn, and you could use a pixel shader to clip() all non-white pixels.
Who is MR occlusion query !? :-)
i'm using directx8 and such this things are not invented yet!

i can get pixels of HMapTex like this :
Dim HMapTex As Direct3DTexture8
Dim lrData As D3DLOCKED_RECT
HMapTex.LockRect 0, lrData, ByVal 0, 0
DXCopyMemory pxArr2(0), ByVal lrData2.pBits, 262144
HMapTex.UnlockRect 0
I found the answer by myself
i have to get backBuffer instead of front buffer
and don't forget to set present flag to D3DPRESENTFLAG_LOCKABLE_BACKBUFFER
anyway Thanks my friends

This topic is closed to new replies.

Advertisement