Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Reply
Old 21-Feb-2010, 10:24   #1
arva
Registered
 
Join Date: Feb 2010
Posts: 4
Default Setting the BackBuffer

Hi, I've been searching how to change the main Back Buffer and unfortunatelly didn't find anything helpful. Basicly I need to change the main pointer to a BackBuffer to a pointer of a surface compatible with the back buffer format. The idea is to get some frames from the main stream and anylyze data in them without using lock methods that are lowing the performance.

So I will:

1.Switch pointers of BackBuffer and my surface.
2.Anylyze data in BackBuffer.
3.Wait 0.5s
4.Switch back the pointers.
5.Analyze data in my surface.
6.Wait 0.5s
7.Switch pointers of BackBuffer and my surface.
8.Anylyze data in BackBuffer.
...

I need only to point me. And maybe also some suggestions about setting my surface format compatible with BackBuffer format. I'm writing my code in C++, DirectX 9.
arva is offline   Reply With Quote
Old 21-Feb-2010, 17:41   #2
Humus
Crazy coder
 
Join Date: Feb 2002
Location: Stockholm, Sweden
Posts: 3,216
Send a message via ICQ to Humus Send a message via MSN to Humus
Default

You can't change the backbuffer AFAIK. What API are you using btw? Can't you just use another render target?
__________________
[ Visit my site ]
I speak for myself and only myself.
Humus is offline   Reply With Quote
Old 21-Feb-2010, 20:25   #3
arva
Registered
 
Join Date: Feb 2010
Posts: 4
Default

I can do that. Thanks:P. But Does the GetBackBuffer(UINT iSwapChain,UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 ** ppBackBuffer)
method returns only the pointer to Back Buffer or it copyies a whole surface? And when I'm accessing the surface that GetBackBuffer method
returned me do I have any possibility to avoid locking the surface?(In fact I don't know how the mechanism of locking surface works). What will happen If
I don't lock the surface? The compilator threats this like a mistake?
arva is offline   Reply With Quote
Old 22-Feb-2010, 19:10   #4
Humus
Crazy coder
 
Join Date: Feb 2002
Location: Stockholm, Sweden
Posts: 3,216
Send a message via ICQ to Humus Send a message via MSN to Humus
Default

GetBackBuffer() only returns the resource pointer to the backbuffer. It doesn't access the data in any way.
Instead of locking the backbuffer directly, which would lead to a stall, you can use GetRenderTargetData() to copy to a surface and then wait a few frames before you lock that surface to make sure that the data is available to avoid the stall.
__________________
[ Visit my site ]
I speak for myself and only myself.
Humus is offline   Reply With Quote
Old 22-Feb-2010, 22:05   #5
arva
Registered
 
Join Date: Feb 2010
Posts: 4
Default

I'm afraid that it would be too slow:/ I need to get 3-4 frames per second and have a direct access to their pixels. Somebody adviced me setting an offscreen surface as a rander target and my actual render target(Back Buffer) as a texture. Then I would be able to get pixel colours via pixel shader. I've read some tutorials about pixel shader but unfortunatelly I still don't know how to get them by pixel shader. Can somebody point me?
arva is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:29.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.