Archived

This topic is now archived and is closed to further replies.

PSioNiC

This questions is REALLY easy or REALLY hard

Recommended Posts

If i have a IDirect3DSurface8 interface thats loaded with good data, how do i copy that surface to the back buffer? If all you have to do is just lock and memcpy, how would i get a pointer to the back buffer?

Share this post


Link to post
Share on other sites
You can get the backbuffer surface using the GetBackBuffer function. Like this:

IDirect3DSurface8 *BackBuffer;

D3DDevice->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &BackBuffer);

Then you should use should use something like copyrects to copy the data to the backbuffer...

If you have multiple backbuffers remember to replace the first parameter with the backbuffer index you are referring - starting from 0.

However I have not done this so correct me if I am wrong.

Edited by - skallio on July 24, 2001 11:05:59 AM

Share this post


Link to post
Share on other sites
I''ve seen the GetBackBuffer method, but i wasn''t sure if it copied the data from the back buffer to your supplied surface, or if it returned a pointer to the back buffer

Share this post


Link to post
Share on other sites
I think it return a pointer to the backbuffer, not a copy of it.
This brought up an idea.. is it possible to use IDirect3DSurface8, GetBackBuffer and CopyRects to simulate DirectDraw... to create HUDs for example.. Wouldn''t it be easier than texturing quads?? So you would fill the HUD graphic in one surface, and then use CopyRects to copy the graphics on the surface to a surface obtained by GetBackBuffer()? Is this possible?

Share this post


Link to post
Share on other sites
quote:
Original post by skallio
This brought up an idea.. is it possible to use IDirect3DSurface8, GetBackBuffer and CopyRects to simulate DirectDraw... to create HUDs for example.. Wouldn''t it be easier than texturing quads?? So you would fill the HUD graphic in one surface, and then use CopyRects to copy the graphics on the surface to a surface obtained by GetBackBuffer()? Is this possible?


Yup. I have done exactly that. I use it to draw a full scene background for a 2D Fighting game I am making. I figured I would make 2 versions of my Graphics engine, one using strict Direct Draw another using D3D8. Works nicely.

-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

Share this post


Link to post
Share on other sites
quote:
Original post by skallio
This brought up an idea.. is it possible to use IDirect3DSurface8, GetBackBuffer and CopyRects to simulate DirectDraw... to create HUDs for example.. Wouldn''t it be easier than texturing quads?? So you would fill the HUD graphic in one surface, and then use CopyRects to copy the graphics on the surface to a surface obtained by GetBackBuffer()? Is this possible?


That sounds like a good idea...one question (if this is a stupid question, forgive me, I''m new at this): would you still keep the features associated with using Direct3D over DirectDraw (like performance, special effects, etc) by emulating DirectDraw like that?

-Normie

"But time flows like a river... and history repeats."
...
So...what about beaver dams?

Share this post


Link to post
Share on other sites
Unfortunately DirectX8 doesn''t include a directdraw interface, and as far as I know you cannot use directdraw7 with d3d8. So you have just the basic features from directdraw... Blt()(CopyRects() in d3d8), IDirect3DSurface8 and GetBackBuffer..

Hmm... no color keying supported in copyrects?

Share this post


Link to post
Share on other sites
No, copy rects is just a brute copy of surface to surface. I use it of scenery or items that do not need color keying. For color-keyed surfaces, I tend to use the ID3DXSprite Interface and change the Alpha value of the color key ( D3DX_ARGB( ) ). I have been able to pretty much emulate DirectDraw with the D3DX library and functions. As for a peformance hit, I don''t know, never really tested that.

-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

Share this post


Link to post
Share on other sites