using directDraw and direct3D together

Started by
11 comments, last by riz 21 years, 11 months ago
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
Advertisement
You can mix them, but it is generally regarded as a bad idea because there is a cost associated with switching back and forth.

A better solution is to go full 3D and draw your UI as textured quads.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
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.
------------------------------BASIC programmers don't die, they just GOSUB and don't return.
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]
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
for text, see CD3DFont in the SDK
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
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.
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.
------------------------------BASIC programmers don't die, they just GOSUB and don't return.
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]???

Brewski
read the 2D in Direct3D articles.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement