Sign in to follow this  

Sceen capture is slow using GetFrontBuffer

This topic is 2891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
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
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
it take about 3 or 4 sec in my pc too get front buffer and it takes so long too process about 700 frames

Share this post


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

This topic is 2891 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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