Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Guide to Game Development/Theory/Graphical User Interfaces (GUI) and Heads-up-displays (HUD)

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

In order to render a GUI or a HUD on top of the gameplay, then you need to clear the depth buffer. Every time you want a new layer of geometry, you'll need to clear the depth buffer to make sure that the layers don't interact with each other. Here's some pseudocode of the drawing of the game, the HUD and the GUI. Render(){ //Resetting from last frame ClearScreen(); DepthBuffer.Clear(); SetProjectionMode(Projection); DrawGameGeometry(); DepthBuffer.Clear(); SetProjectionMode(Orthographic); DrawHUD(); if (isMenuOpen){ DepthBuffer.Clear(); //Let's say it's a 2D GUI, so going to leave it as orthographic DrawGUI(); } } 25%