Sign in to follow this  
hserver

Sceen capture is slow using GetFrontBuffer

Recommended Posts

hserver    142
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?

Share this post


Link to post
Share on other sites
Tom KQT    1704
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.

Share this post


Link to post
Share on other sites
hserver    142
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?

Share this post


Link to post
Share on other sites
Tom KQT    1704
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"?

Share this post


Link to post
Share on other sites
mososky    100
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.

Share this post


Link to post
Share on other sites
mososky    100
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.

Share this post


Link to post
Share on other sites
Tom KQT    1704
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

Share this post


Link to post
Share on other sites
Evil Steve    2017
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.

Share this post


Link to post
Share on other sites
hserver    142
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this