diff --git a/src/ticker.cpp b/src/ticker.cpp index ff6f00bf..ed5ebfdc 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -221,6 +221,17 @@ void Ticker::TickDraw() /* Tick objects for the draw loop */ for (int i = Entity::DRAWGROUP_BEGIN; i < Entity::DRAWGROUP_END; i++) + { + switch (i) + { + case Entity::DRAWGROUP_HUD: + Video::SetDepth(false); + break; + default: + Video::SetDepth(true); + break; + } + for (Entity *e = data->list[i]; e; e = e->drawnext) if (!e->destroy) { @@ -236,6 +247,7 @@ void Ticker::TickDraw() e->state = Entity::STATE_IDLE; #endif } + } Profiler::Stop(Profiler::STAT_TICK_DRAW); Profiler::Start(Profiler::STAT_TICK_BLIT); diff --git a/src/video.cpp b/src/video.cpp index 936c58ff..78172d43 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -36,13 +36,6 @@ void Video::Setup(int width, int height) glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0); - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_LEQUAL); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.01f); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); } @@ -89,8 +82,23 @@ void Video::SetFov(float theta) glLoadIdentity(); } +void Video::SetDepth(bool set) +{ + if (set) + glEnable(GL_DEPTH_TEST); + else + glDisable(GL_DEPTH_TEST); +} + void Video::Clear() { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LEQUAL); + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GEQUAL, 0.01f); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); SetFov(0.0f); diff --git a/src/video.h b/src/video.h index f05c9652..ce676b8e 100644 --- a/src/video.h +++ b/src/video.h @@ -19,6 +19,7 @@ class Video public: static void Setup(int width, int height); static void SetFov(float theta); + static void SetDepth(bool set); static void Clear(); static void Capture(uint32_t *buffer); static int GetWidth();