Advertisement

Mixing DD and D3D

Started by March 16, 2000 05:49 PM
13 comments, last by Rasta 24 years, 11 months ago
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
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"
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
Advertisement
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).
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
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."
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
Advertisement
In Awsome Power of Direct3D it says that it is forbidden operation to blit between the BeginScene and EndScene functions calls.

Gandalf the White
Gandalf the Black
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.
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.
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!

This topic is closed to new replies.

Advertisement