Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Frontbuffer pointer?

Author
Message
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 9th Apr 2012 17:05
I've tried this:



But it don't work.

I'm trying to get the *pBits and other surface info from the final rendered screen after a sync if anyone can help.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
JTK
10
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 9th Apr 2012 19:12
Not sure if "Various methods for capturing the screen" helps you, but as the name suggests, it gives various examples of grabbing the current screen image.

Regards,
JTK
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Apr 2012 20:50
Thanks JTK for reminding me about that page. I had been reading that previously also.

Now I'm confused on how to copy a Direct3DSurface pBits over to a HBITMAP. Something to do with using HDC's, but I've never had to use them so far. Everything is compiling though, so it's just research and experimenting til I get it right...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Apr 2012 04:17 Edited at: 12th Apr 2012 05:14
I've tried and tried with no luck. The screen grab just ain't doing anything.

Anybody any ideas?



It creates just blank images...

EDIT: Just updated using BITMAPINFO instead of BITMAPINFOHEADER but still not working...

EDIT2: I have even just added this instead of BitBlt in case BitBlt wasn't working... (Everything runs but still saves blank images.)


Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 12th Apr 2012 16:53
I have done this but can't find the code, I will take another look.

Just to be sure I have got this right, you are looking for a way to grab the whole screen contents, including things outside your app window?

WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Apr 2012 20:06
Thanks Matty for having a look.

At the moment I'm just trying to grab the contents of the Window if in windowed mode or the full screen contents if in that mode. I'm just working in windowed mode at the moment.

The idea is to copy the final render into a HBITMAP structure as quickly as possible so I'll be benchmarking (if I get it working right) the difference between a BitBlt operation and what I've used up there in assembler. I'm also hoping that I can get it to do at least some of it on multi-threading too.

The video rendering code all works when a HBITMAP is properly setup but my problem is that I've never had the need to use DC's etc.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Brendy boy
14
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 12th Apr 2012 22:15
Are you using dbSetDisplayMode function anywhere in your code?
I have a code for frontbuffer grabbing and it doesn't work if i use that command.
If you're not using it tell me and i'll post my code

WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Apr 2012 00:05 Edited at: 13th Apr 2012 00:06
So far it's not because it's just running off the basic window 640 x 480.

EDIT: not sure that using dbSetDisplayMode() would harm anything...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Brendy boy
14
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 13th Apr 2012 00:38
Some declarations


Creating surface and render target


Grab Backbuffer



Save the data from backbuffer to color array



Save the data from color array to HBITMAP


This is how I grab the d3d device


WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Apr 2012 00:45
@Brendy Boy - Thank you so much. I'll see what I can come up with now. Fingers crossed I'll find out what mistakes I've actually made and it will help me understand DC's a bit more.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Apr 2012 05:11 Edited at: 13th Apr 2012 05:29
Hey guys... After mucho messing about with this I researched all the DC and HBITMAPS a bit more and then tried out a completely different method which didn't use DirectX.

It worked and it's very reasonably fast. Yerse!!!

EDIT: The only thing I need to do now is to set it so it just grabs the inside area of the window. More research...

Here's the snippet:



Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2020-02-20 07:43:58
Your offset time is: 2020-02-20 07:43:58