Jump to content
  • Advertisement

Archived

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

Rasta

Mixing DD and D3D

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

Is it perfectly ''legal'' to use DD functions like BltFast and Blt on a D3D rendering surface between the BeginScene and EndScene function calls when working with D3D IM? I''m using BltFast to draw a fullscreen background and then I am using DrawIndexedPrimitive to draw polygons over it. It seems kinda strange at first, but it works. Rasta

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can use them together just fine. But I think there is somewhere in D3D that lets you setup a default background, so that you dont have to use ddraw for just that. But I don''t remember where it is

One person said that the games industry is "a transfer of funds from the rich to the lucky"

Share this post


Link to post
Share on other sites
I''ve read somewhere that it''s legal. I''m blitting a sea/sky background, overlaid by 3d terrain, then a 2d cockpit blit in my flight sim attempt. This back buffer is then flipped to the foreground surface. BTW surfaces are nothing more than bitmap images (non-inverted).

Share this post


Link to post
Share on other sites
I was just wondering if this is the standard way of putting up
a fullscreen 640x480 background, or am I in trouble of corrupting
the D3D rendering pipeline somehow?

Actually, I did try putting it up as a texture at first, but
I quickly found out the dimensions of textures need to be in
powers of 2 (is this correct?) and the background came out
looking pretty bad.

Just now, I took the blitting of the background part out of
the BeginScene and EndScene section, and placed it immediately
before it and it still works.

Rasta

Share this post


Link to post
Share on other sites
Yeah, they need to be powers of 2. I wouldn''t use textures because as the size gets bigger (around 256x256), D3D starts slowing down.

"When people tell you they want to hear the truth, you know that their lying."

Share this post


Link to post
Share on other sites
I found this bit of advice on another site:

Typically your main loop for an individual render target should be:

Clear Z Buffer/Render target (if required)
Any background 2D
Begin Scene
3D Rendering
End Scene
Any foreground 2D
Flip

Which seems like a good way to set things up in my case.

Rasta

Share this post


Link to post
Share on other sites
In Awsome Power of Direct3D it says that it is forbidden operation to blit between the BeginScene and EndScene functions calls.

Gandalf the White

Share this post


Link to post
Share on other sites
The loop above works fine for me. The APofD3D (page 340) simply says to complete the 3D layer before overlaying 2D - it doesn''t preclude mixing 2D and 3D. It also indicates that you can access a surface as a window using GetDC() and Lock(), etc. I''ve used this to overlay text and a few simple graphics from the windows GUI.

Share this post


Link to post
Share on other sites
I''ve had trouble using blits with direct3d. I tried it in tons of different places, and never seemed to work. I''ll have to go back and take another look at it.

The blits would go through without an error, but nothing would show up, and it used to work fine before I converted to D3D. But I must''ve set something up wrong.

Share this post


Link to post
Share on other sites
I experimented with this quite a bit when I was working on the D3D tiles article. The loop described by Rasta was the one I found that worked reliably. A word of warning, though - if you load bitmaps into system memory, there are sometimes some odd effects when you are using D3D''s texture management system. D3D isn''t as smart as it could be, sometimes!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!