Archived

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

Direct3D and DirectDraw

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

Better to ask, how to combine directDraw with direct3D, or how to use Direct3DSurface to draw 2D graphics.
I have use getbackbuffer to get the Device3D back buffer, but the got invalid call when calling lockrect onthat surface.
Is it possible to get a pointer to the device3D surface and draw?

Share this post


Link to post
Share on other sites
Direct3D 8+ have 2D sprite support. You don''t actually need DirectDraw unless you''re doing a pure 2D app and you don''t need to extra stuff Direct3D allows

Share this post


Link to post
Share on other sites
I hear you have to do one at a time when drawing. No inter-mingled drawing from the ddraw and d3d device. Something like that.. You could beat your brains over using a depth buffer though :D

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
D3DXSPRITE is what you need, I guess you just set it up the same way as the 3d, I think it has a pointer to the 3d device.

Share this post


Link to post
Share on other sites
Hi can any one add a bit more to this thread, such as how to do it. In the sdk it says you need a RECT, I'm not sure what a RECT is but I did this,

RECT My_RECT
Long My_RECT.Top = 0.0F;
Long My_RECT.Left = 0.0F;
Long My_RECT.Right = 64.0F;
Long My_RECT.Bottom = 64.0F;

The first thing I noticed is the word RECT didn't change colour, so it's not a key word anyway, so that isn't going to help?

What I have figured out so far;
1 The sprite will eventually get rendered by the same g_pd3dDevice as the 3d stuff,- so no need to make a new device, just point to that one.
2 The way the texture is held is just the same LPDIRECT3DTEXTURE8 g_pTexture = NULL; so thats ok, just add more of these for what ever textures you want.

That's about all I know so far, one other thing is the Draw function starts with a HRESULT does that mean you have to follow it with an error checking thing.








[edited by - Stevieboy on October 14, 2003 1:11:00 PM]

Share this post


Link to post
Share on other sites
RECT isn''t a keyword but it is a class (or struct or something) defined by the windows API... why are you using "long"? Are you using C or C++ or some other language?... it seems like you may not be familiar with classes or structs... but maybe I just read your post wrong

Share this post


Link to post
Share on other sites
I just found Long used some where. I used structs for FVF''s so I have used them before. I''m looking through a couple tutorials on the sprite thing now, so hopefully that should help.
Thanks anyway

In case any one else needs them,
gamedev tutorial
http://www.gamedev.net/reference/programming/features/d3dsprite/
NeXe tutorial
http://nexe.gamedev.net/tutorials/list.asp

Share this post


Link to post
Share on other sites