From b0aa1ad7a806db85b0e3b3525609c85f483ad6f5 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Tue, 30 Jun 2020 01:51:01 +0200 Subject: [PATCH] Fixed BlockCursor display. --- source/client/graphics/Framebuffer.cpp | 2 ++ source/client/hud/HUD.cpp | 2 -- source/client/hud/HUD.hpp | 2 ++ source/client/states/GameState.cpp | 5 ++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/client/graphics/Framebuffer.cpp b/source/client/graphics/Framebuffer.cpp index 08813a075..e4913c478 100644 --- a/source/client/graphics/Framebuffer.cpp +++ b/source/client/graphics/Framebuffer.cpp @@ -172,6 +172,8 @@ void Framebuffer::end() const { gk::Shader::bind(nullptr); glActiveTexture(GL_TEXTURE0); + + glEnable(GL_DEPTH_TEST); } void Framebuffer::bind(const Framebuffer *framebuffer) { diff --git a/source/client/hud/HUD.cpp b/source/client/hud/HUD.cpp index fb5c4d9a8..82bb44fb2 100644 --- a/source/client/hud/HUD.cpp +++ b/source/client/hud/HUD.cpp @@ -102,8 +102,6 @@ void HUD::update() { } void HUD::draw(gk::RenderTarget &target, gk::RenderStates states) const { - target.draw(m_blockCursor, states); - target.disableView(); states.shader = &m_shader; diff --git a/source/client/hud/HUD.hpp b/source/client/hud/HUD.hpp index e39862d65..a8d43b55b 100644 --- a/source/client/hud/HUD.hpp +++ b/source/client/hud/HUD.hpp @@ -49,6 +49,8 @@ class HUD : public gk::Transformable, public gk::Drawable { void update(); + const BlockCursor &blockCursor() const { return m_blockCursor; } + Chat &chat() { return m_chat; } private: diff --git a/source/client/states/GameState.cpp b/source/client/states/GameState.cpp index 109f2adce..8837b3ee5 100644 --- a/source/client/states/GameState.cpp +++ b/source/client/states/GameState.cpp @@ -208,10 +208,9 @@ void GameState::draw(gk::RenderTarget &target, gk::RenderStates states) const { if (it.second.dimension() == m_player.dimension()) target.draw(it.second, states); - m_fbo.end(); + target.draw(m_hud.blockCursor(), states); - states.shader = &m_shader; - glEnable(GL_DEPTH_TEST); + m_fbo.end(); target.draw(m_hud, states); }