#### Archived

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

# How to do layering with DirectDraw surfaces on top of Direct3D scene?

This topic is 6423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
I think it would be much simpler to create a square polygon and texture map your 2d-sprites onto it. It would simplify problems between D3D and DDraw alot.

##### Share on other sites
Well, right now the terrain tiles are rectangular bitmaps that get mapped into isometric diamonds by the texture loading function. I don''t see how I can continue to do this for the 2d sprites because they will definitely get warped upon loading. Unless you''re saying that I draw the diamond-shaped tiles in a paint program but I read some article that says this is very time-consuming work. Of course I could have interpreted your post wrongly.....if so don''t hesitate to clear things up.

##### Share on other sites
To render your units as square polygons, just change the vertexs to the top left and bottom right of your square (not diamond) shape, then call your procedure to set the unit texture and then call DrawPrimitive();

I played around with brackets engine, and have added walls to it, and I''m currently trying to get a zoom function to work correctly.

If you look at how the diamond is created in the vertex[] structures you will see that by simply moving the positions of the corners you will achive the square end product.

  Bracket does the following: 1 /\ / \ / \0/ \3 \ / \ / \ / \/ 2change the points so that they are like this:1 3 +----+ |\ | | \ | | \ | | \| +----+ 0 2if this is wrong ( I think I may have to points labels wrong) then try moving the points around.

Don''t forget to render your units inside of a StartScene() and EndScene() block

##### Share on other sites
hi Steven,

are you saying I should convert all the vertices to form squares instead of diamonds? wouldn''t i then have to draw diamonds (not an easy task according to some articles)? or did you try layering squares on top of diamonds - in other words keep Bracket''s code but extend it further by rendering squares for subsequent layers. Does that work?

Well, right now it''s the marriage of D3D and DDraw that I can''t seem to get working. I thought i''d be better off just using DDraw and blit from offscreen surfaces to the backbuffer b4 flipping. But I get an unknown error from BltFast(), it''s none of the HRESULT values that are returned as stated in the SDK. The problem is in function Layer1Render() right after Demo4Render(). What I''m I doing wrong here? Please feel free to take a look at my code at

http://www.geocities.com/epic709

it''s a mess right now but just try to ignore all the commented out stuff.

##### Share on other sites
well, the problem above has been solved. Thanks anyway.

##### Share on other sites
I''ve just checked this message again, and relised I may not have been clear (from your reply i do not think I was)

You can still draw your iso tiles as diamonds, and when you go to draw your units change the vertex structs to make a square and set the texture to the unit texture.

One thing I noticed from your code is your textures are the same size as the texture bracket used, you do not need to set them to that size, unless you need the extra details.

if you want to see what I''ve done with the engine check out my site:

www.stevesprogpage.f2s.com