User Interface Programming in Direct3D 9.

Started by
1 comment, last by zarthrag 20 years, 6 months ago
Seeing that there are next to no blitter functions in Direct3D, and no more DirectDraw in DirectX 9.0. How does one go about creating an onscreen hud/gui in games. My renderer is fine, and I can put text up on the screen. But how do I actually go about creating a nice GUI with frames, icons, scrolling text, etc? Transparency would be nice, so would alpha blending. Sure, I could rig up some textured quads and stick them to my camera, but I''d much rather keep those functions separate from the 3D engine portion of my code, and more with the scripting part. I''d also rather it be a separate function. That is, rendering a new frame, and updating the GUI would be two different things. Perhaps there is support for some kind of "overlay" function?
"This I Command" - Serpentor, Ruler of C.O.B.R.A
Advertisement
I''m actually working on the same thing. So far, I''ve decided that all Gui rendering will happen at the end of the frame. It''s also all blended, and fonts come from texture pages.

Each window will set the viewport for clipping itself and its children ( buttons, text, etc. ), and will typically render itself and all of its childern in one draw call.

That implies you need all your fonts in one texture, or use only one font per window ( possibly at different font sizes using texture coordinate scaling ).

Drawing the whole gui in one go is prohibitive, because then you can''t easily limit the rendering to the window client area - which would prevent you from clipping text to the window, and supporting resizable, scrollable windows.

The windows will be rendered in back to front order, and will will have srcalpha/invsrcalpha blending on all the time, and alpha test set to throw away srcalpha == 0.

Fonts will have their drop shadows done via opaque black, so you don''t have to render the fonts twice.

Anyways, those are my plans for now.
I''ll move this to the DirectX forum.

This topic is closed to new replies.

Advertisement