Archived

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

Where is directdraw? Blitting with d3d9.

This topic is 5309 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

I''m learning directx9 since some time, but i ran into a problem while trying to make a basic framework for a game. I want to have the possibility of using hardware blits for 2d-operations (control panels, text, maybe billboards). 1 Can d3d9 and directdraw coexist? If so, how do i initialize them to coexist? 2 Does d3d9 use the hardware blitter in any way? for example when i make a square with vertices that are all in screen-space. 3 What about using the dx utility-library, especially DXSprite? Is it fast? Does it use the blitter without manually having to create a directdraw object? Thnx already for ur answers. It seems i can only find pieces of information about this on the internet. It doesn''t give me a complete picture. MSDN is maybe least helpfull of all

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
DirectDraw was, for most purposes, taken out of DX8. You can use the D3DXSprite - but I prefer to make my own sprite class using 4 vertices and an index bufer.

Then load a texture and apply it to your "sprite". If you are using the fixed pipeline and want to use screen coords you can use RHW in your shader format. Otherwise with the programmable pipeline you could write (or find) vertex shader code to accomplish it for you.

Hope this helps some!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
DirectDraw still exists in DX 9. If Microsoft adheres to the COM specification DirectDraw will continue to exist in ALL subsequent releases of DX as well.

One of the fundamentals of COM, upon which DX is based, is that new functionallity and interfaces can be added. Existing interfaces and functionality MUST be preserved so as not to break existing code.

I have a DirectDraw wrapper library that I wrote back in the DX 5 days. With the exception of DirectInput, I have had to make no code changes with DX7, DX8 or DX9. I just recompiled. Everything still works great.

Share this post


Link to post
Share on other sites
thnx, this helps quite a lot!

Still, i''m wondering about performance.
Do u think using the fixed pipeline will be just as fast as an oldfashioned blit? Or does it even use the blitter implicitly?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If you use quads to do a fake blit, it will be very fast on modern cards.

Share this post


Link to post
Share on other sites
quote:
1 Can d3d9 and directdraw coexist? If so, how do i initialize them to coexist?

No.
quote:
2 Does d3d9 use the hardware blitter in any way? for example when i make a square with vertices that are all in screen-space.

If it's a 3D primitive, no, it'll go through the 3D pipeline, even if you specify transformed (screen-space) vertices.

Take a look at IDirect3DDevice9::StretchRect. I think you can safely expect it to use hardware blitting.
quote:
3 What about using the dx utility-library, especially DXSprite?
Is it fast? Does it use the blitter without manually having to create a directdraw object?

It's a 3D primitive wrapped to look like a sprite. It's probably fine for small numbers of sprites and screen-space stuff, but for particle effects and other cases where you'd have a lot of them, a single dynamic VB will be a lot faster.
quote:
MSDN is maybe least helpfull of all

StretchRect is mentioned under "2-D Support" on the "What's New in DirectX Graphics" page.
quote:
One of the fundamentals of COM, upon which DX is based, is that new functionallity and interfaces can be added. Existing interfaces and functionality MUST be preserved so as not to break existing code.

COM stipulates that you can't change an interface once it's been published, but it doesn't require you to continue supporting old interfaces into eternity. Nothing in COM requires new versions of DirectX to include all the old interfaces, that's just a choice they've made.

[edited by - Donavon Keithley on June 3, 2003 9:15:53 PM]

Share this post


Link to post
Share on other sites
This is what it says on MSDN:

"2-D Support. Added support for a color-converting blit between most types of D3DPOOL_DEFAULT surfaces while using IDirect3DDevice9::StretchRect, and a color fill operation for D3DPOOL_DEFAULT surfaces while using IDirect3DDevice9::ColorFill."

So I guess indeed, all of the blit capabilities are hidden in this function.

Share this post


Link to post
Share on other sites