Archived

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

riz

using directDraw and direct3D together

Recommended Posts

Hey all, For a small game that a friend and I are writing, we want to provide an interface to the game (ie, new game, quit, etc). We were thinking of doing the interface in DirectDraw and then the game is a Direct3d game (sort of a 3d breakout). How is the interface normally created in industry, can you *mix* directdraw and direct3d and use them both in the game? Some high-level pseudocode would be much appreciated! regards, Riz

Share this post


Link to post
Share on other sites
IIRC, that''s how D3D 7 Immediate mode worked. Of course, it was built on top of DirectDraw, so i think you basically had to use them together.

------------------------------
BASIC programmers don''t die, they just GOSUB and don''t return.

Share this post


Link to post
Share on other sites
in the industry, textured quads as said are used. since you are just mapping the image data onto a rectangualar surface, its very similar to blitting. plus there is not much use of using directdraw just for the interface. especially if the game is being done in d3d.

cons of directdraw with d3d:
1. cards dont like switching back and forth. expensive time wise. any switch halts the cpu, forces the driver to flush the queue and then allows you to continue. furthermore, while doing a directdraw stuff, the gpu cant do anythign useful. ussually in a d3d app you send the vertex data through the api to the card with calls to Draw*Primitive() and they return almost instantly. the card then already starts drawing while the cpu is busy preparing the next set of data. for instance if you need to transform data, do some physics, etc.
2. d3d is using much of the availible vram, chunking things off for directdraw surfaces will get confusing and will be a managment nightmare.
3. by going only d3d you can use d3d8 which is MUCH cleaner and easier to use then d3d7.
4. all the benefits normally asscoiated with directdraw, cant be used effectivly with d3d. (ie direct pixel manipulation, since your at a higher res then you would be with directdraw, means more bandwidth, plus its SLOW to read from vram if you decide to do custom stuff with the video data.).

EDIT: removed stupid comment.

[edited by - a person on May 1, 2002 2:02:31 PM]

Share this post


Link to post
Share on other sites
sounds good...
now if we were going to use that same concept (textured quad in d3d) as a way to display information (such as score, etc.) in the same way as 3d shooter display information at the bottom (health, etc.), how would we do that? I''m confused as how to update the "texture" on the quad...

thanks,
riz

Share this post


Link to post
Share on other sites
just like you would normally do blits from a sprite surface. instead of blits, you use textured quads the correct uv coordinates. for things like health and other bars, you can just size the quad. i think you should read some of the 2d using d3d tutrials out there.

Share this post


Link to post
Share on other sites
quote:
Original post by a person
GarlandIX, and thats why you dont use immediate mode for anything except because its there.

Hmmm... Good point, except my video card doesn''t support d3d8.



------------------------------
BASIC programmers don''t die, they just GOSUB and don''t return.

Share this post


Link to post
Share on other sites
If you would to do say a pixelarray[width*height], which i use with directDraw and copy to backbuffer each frame, how would I do that with d3d, set up a 2d vertice-buffer[width*height]???

Share this post


Link to post
Share on other sites
GarlandIX, whoops. heh. i misread. i thought you said retained, instead of immediate mode. well, in either case you can run dx8 apps on your card. there is no excuse because any card that supports dx6 can run dx8. you dont get all the new features, but it works. how do i know this? well besides it was being stated in the sdk, both my 4mb ati rage pro and 12mb voodoo2 dont seem to mind working with dx8.

Share this post


Link to post
Share on other sites
quote:

GarlandIX, whoops. heh. i misread. i thought you said retained, instead of immediate mode.

LOL! I can understand that!

quote:

well, in either case you can run dx8 apps on your card. there is no excuse because any card that supports dx6 can run dx8. you dont get all the new features, but it works. how do i know this? well besides it was being stated in the sdk, both my 4mb ati rage pro and 12mb voodoo2 dont seem to mind working with dx8.


What about my 8mb AccelSTAR II? I ran dxDiag.exe and it worked perfectly with the dx7 interfaces, but gave me an error when trying the dx8 ones(HRESULT=Ox8876086a--3D not available) Anyone know why this happens? And does anyone know how to fix it? I have already unsuccessfully STFW'ed, so I would be eternally grateful if someone could help me with this.

------------------------------
BASIC programmers don't die, they just GOSUB and don't return.

[edited by - GarlandIX on May 1, 2002 7:30:58 PM]

Share this post


Link to post
Share on other sites
that is weird. if you can find out the chipset, maybe you can get the updated reference drivers instead since they would be more up to date. though you may lose some special features of your vendor version like video capture or tv out.

Share this post


Link to post
Share on other sites