add depth

This commit is contained in:
2023-06-26 09:37:23 +02:00
parent 36f37b6548
commit c9ee8216be

View File

@@ -49,7 +49,9 @@ bool Renderer::Init() {
#endif #endif
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_LESS);
InitShaders(); InitShaders();
return true; return true;
} }
@@ -71,7 +73,7 @@ void Renderer::RenderModel(const Model& model) {
} }
void Renderer::Prepare() { void Renderer::Prepare() {
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(m_BackgroundColor.r, m_BackgroundColor.g, m_BackgroundColor.b, 0); glClearColor(m_BackgroundColor.r, m_BackgroundColor.g, m_BackgroundColor.b, 0);
} }