From 32ef3b85892b7c76035f220384556fc2b0bc4ff1 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Mon, 22 Apr 2024 00:42:41 +0300 Subject: [PATCH] use depth buffer --- makefile | 1 + src/car_widget.cpp | 12 +++++++++--- src/main.cpp | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index f05f48b..15e97bb 100644 --- a/makefile +++ b/makefile @@ -21,6 +21,7 @@ else ifeq ($(os),linux) endif this_ldlibs += -lruisapp-opengles-xorg -lpapki -lclargs -ltml -lruis -lutki -lm +this_ldlibs += `pkg-config --libs glesv2` $(eval $(prorab-build-app)) diff --git a/src/car_widget.cpp b/src/car_widget.cpp index 3caff55..311aa48 100644 --- a/src/car_widget.cpp +++ b/src/car_widget.cpp @@ -23,6 +23,8 @@ along with this program. If not, see . #include +#include + using namespace carcockpit; car_widget::car_widget(utki::shared_ref context, all_parameters params) : @@ -101,15 +103,19 @@ void car_widget::render(const ruis::matrix4& matrix) const ruis::matrix4 matr(matrix); matr.scale(this->rect().d / 2); matr.translate(1, 1); - matr.scale(1, -1); + matr.scale(1, -1, -1); // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) matr.frustum(-2, 2, -1.5, 1.5, 2, 100); matr.translate(0, 0, -4); matr.rotate(this->rot); - // glEnable(GL_CULL_FACE); + glDisable(GL_CULL_FACE); + + glEnable(GL_DEPTH_TEST); this->context.get().renderer.get().shader->pos_tex->render(matr, *this->cube_vao, this->tex->tex()); - // glDisable(GL_CULL_FACE); + glDisable(GL_DEPTH_TEST); + + glEnable(GL_CULL_FACE); } diff --git a/src/main.cpp b/src/main.cpp index 6a86ad5..8b56102 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,7 @@ class application : public ruisapp::application []() { // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers) ruisapp::window_params wp(r4::vector2(1024, 600)); + wp.buffers.set(ruisapp::window_params::buffer::depth); return wp; }() )