Skip to main content
GameDev.net gamedev.net
🔒 Locked

Three basic DirectX 8 questions

Started by Courtney Apr 9, 2001 at 11:27 PM 5 replies 400+ views
Original Post
Courtney
Courtney
First, I am writing a Direct3D game and it is so far working. However, I want most of the screen to be a 3D world with the right column (1/4) of the screen used for displaying scores, times, etc... I want this column to be a bitmapped image with text that changes during the game. Do I create a 3D object that covers this part of the screen, and map a bitmap texture onto it (adding the text onto of that) or is there a way to use the DirectDraw bitblt to handle this part of the display (after initializing Direct3D)? Which leads me to a second question...The opening menu and configuration screens are best suited to DirectDraw and simple bitblts. Is it a common practice to use both Direct3D and DirectDraw in the same program? Which again leads to my final question...displaying text on a Direct3D screen. The DX8 SDK has a rather complicated sample that displays the text by loading the Windows Fonts, creating 3D objects on the fly that the text is mapped onto as a texture. It works (even in my program) but it seems very convoluted. Is there an easier way?
Psychocatt
Psychocatt
I''m still learning DX myself, so I don''t know if all of this is accurate or even the best way, but I thought I''d share my thoughts!


I want most of the screen to be a 3D world with the right column (1/4) of the screen used for displaying scores, times, etc... I want this column to be a bitmapped image with text that changes during the game. Do I create a 3D object that covers this part of the screen, and map a bitmap texture onto it (adding the text onto of that) or is there a way to use the DirectDraw bitblt to handle this part of the display (after initializing Direct3D)?


From what I have read in other threads, the way to do this would be to draw the 3D stuff, and then set up an orthoangle(sp?) view and draw the 2D stuff using a quad. As far as I know in DX8 there isn''t a way to switch from 3D to 2D. I don''t know about DX7 and earlier as I just started with DX8.


Which leads me to a second question...The opening menu and configuration screens are best suited to DirectDraw and simple bitblts. Is it a common practice to use both Direct3D and DirectDraw in the same program?


I don''t know what is common, but I would think that they would do 2D and then once the game starts, go 3D. It would be eaisier, I would think. I was thinking though, why not just do everything in 3D? I don''t think I have seen many games that have 3D menu systems. It would seem to me that if you are doing a 3D game, why not make the menu/title 3D? Just a though.


displaying text on a Direct3D screen. The DX8 SDK has a rather complicated sample that displays the text by loading the Windows Fonts, creating 3D objects on the fly that the text is mapped onto as a texture. It works (even in my program) but it seems very convoluted. Is there an easier way?


Again, from what I have read, the best way would be to create a texture of text and then place it on a quad and render using an orthoangle(sp?) view. But the basic idea is the same.

Probablly not as much information as you were looking for, but hope it helps! Good luck with your game!

Pactuul
Pactuul
what psychocatt suggests is very valid. You should draw all the 3d stuff and then switch the projection to an orthagonal projection and draw the box where you want with the scores on top. You will still be able to do alpha-blending, texture placing, etc.


Pactuul

"The thing I like about friends in my classes is that they can''t access my private members directly."



-Pac "The thing I like about friends in my classes is that they can't access my private members directly." "When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."
Moe
Moe
I think I may have stumbled onto the solution of the 2d/3d problem by accident.

If I am not mistaken, it is possible to create multiple vertex types, so you could have one for the 3d points (untransformed and unlit) in the 3d part of your game, then have another vertex type (pretransformed, prelit) for the 2d parts. The only problem with this is that you would have to clear your vertex buffer twice for each frame, if I am not mistaken.
Courtney
Courtney
Pactuul & Psychocatt (and others) thanks for your input..being a newbie to DX can be daunting to say the least (even for a programmer who has been in the biz for 10+ years).

Pactuul, in your statment "switch the projection to an orthagonal projection and draw the box where you want with the scores on top"... I assume that the "box" is still a 3D object which would have a texture of the image I wanted displayed?

The "orthagonal" projection is a right-angle(?) projection that would display this 3D object head on (thus appearing 2D)?

Thus I am not really displaying a 2D bitmap directly (as I would using a Blt with Directdraw) but instead simulating a 2D appearance by viewing a straight on view of a textured 3D object?

Am I getting close?

Thanks again for all your input!
DrunkenHyena
DrunkenHyena
G''day!

You can''t mix DirectDraw with Direct3D in DX8. You can in DX7 though. If DX7 does all you want you can do all your 3D rendering with D3D7 and then blit the stuff you want on top.

If you want to use D3D8 then your best bet is to have an extra Vertex Buffer to hold Transformed/Lit vertices (coords in screen space) and draw it last. Switching vertex buffers isn''t that expensive. This way you''re faking 2D and don''t have to mess with your matrices.

I haven''t actually gotten around to playing with fonts yet, so I''m not going to make any suggestions until I have something similar to a clue.



Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
Pactuul
Pactuul
Your exactly right Courtney... Even when setting to the ortho-view your still in 3d and still placing a box in 3d space, but like you said, it''s just a straight on view and thus removes the "tapering" effect from the horizon. So you can still place stuff behind other stuff by specifying different z-values.
-Pac "The thing I like about friends in my classes is that they can't access my private members directly." "When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.