Skip to main content
gamedev.net
🔒 Locked

SetRenderTarget / Screenshot

Started by spade 2 replies 350+ views
Original Post
spade
spade
Hi, my problem is the following one: I have a working D3D-App, this app draws something on screen. My problem now is, I need the RGBA values of the image which is drawn to screen. I have just tried to make a screenshot, works great, but I only need the values of my app not the whole screen. I thought of something like setting the RenderTarget to a special surface, let the app render everything and convert this surface to a DIB. So that I can get the pixels RGBA. For now I convert the Backbuffer to a DIB. Can anybody give me a hint, if this is completly crap or this is the right direction? Is the a better/faster way ? Best Regards.
Assassin
Assassin
You can LockRect() on a subsection of the front-buffer. The subsection you want is whatever the RECT of your window is. You can obtain the current app''s rect with GetWindowRect and then a window''s client rect via GetClientRect. The window rect is in screen or desktop coords, the client rect is relative to the top/left of the app rect, I believe, so you need to add top/left window coords to the client rect coords to get "screen coords" of your sub-window.

If you lock and save that part of the surface which you obtain through the GetFrontBuffer call (which I''m assuming you''re using, because that''s what I do for screenshots), then you can get just the 3D part of your app.

You can also lock the app''s rect and grab the part of the front buffer that also includes any window borders and other child windows that your app runs if you so desire.
Assassin, aka RedBeard. andyc.org
S1CA
S1CA
- Hold down Alt when hitting the PrtScr key, that''ll just screenshot the currently active window.

- Purchase some shareware such as HyperSnap DX

- The direct method mentioned by Assassin (which will be about your only choice apart from a 3rd party program for fullscreen apps)

- DIBs which should work. But only for windowed mode apps.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
spade
spade
thank you for your fast answer, I''ll try that.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.