I want to create status bar (2d) in d3d

Started by
6 comments, last by notehaha 22 years, 4 months ago
Hi, Now,I finished build 3d models and I also render them to my game. Then, I want to create status bar that representing model''s HealthPoint. You know?The HealthPoint Bar must show me in the same place,when I change camera point. I think it must be use 2d surface. I''ve read "GameDev_net - 2D Rendering in DirectX 8" Tutorial. But it be use in 2d graphic only ,or not??. So ,Could anyone tell me how to make 2d surface in finished 3d world? I want 2d surface showing,and 3d world behind 2d surface showing too.
Advertisement
Set up your 3D matrices, render the 3D stuff. Switch to the 2D ortho matrix and render the 2D stuff. Rinse and repeat.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
just only set Projection?

in render loop:
{
d3ddevice->settransform(D3DTS_PROJECTION,&Ortho2d);
Draw2d();

d3ddevice->settransform(D3DTS_PROJECTION,&Perspective);
Draw3d();
}

Only this?

Ok, I will try.
Thank you for your fast reply.
You may want to (re)set your view and world matrices depending on what you are doing in the 3D space...

If you have everything working in 3D and you understand the article, just flipflop the matrix states between 2D "mode" and 3D "mode"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
G''day!

Alternately you can use transformed vertices and not bother changing any matrices.


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
Actually, yes - if you never need to bother changing the position of anything, use transformed. This is probably the case for a status bar. Good point.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Your ideas enlighten me.
I finished the status bar.

Thank you for your kindness.
I use transformed vertices. Try looking at the 3dFont sample included with the SDK. They use tranformed and lit vertices for drawing 2d text on the screen using screen coordinates. This is, in my opinion, the easiest and most intuitive way of drawing 2d such as menus, status bars, or any kind of GUI. HTH.
Arcus

This topic is closed to new replies.

Advertisement