Skip to content

Commit

Permalink
use depth buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Apr 21, 2024
1 parent a1c4bfd commit 32ef3b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
12 changes: 9 additions & 3 deletions src/car_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#include <ratio>

#include <GLES2/gl2.h>

using namespace carcockpit;

car_widget::car_widget(utki::shared_ref<ruis::context> context, all_parameters params) :
Expand Down Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class application : public ruisapp::application
[]() {
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
ruisapp::window_params wp(r4::vector2<unsigned>(1024, 600));
wp.buffers.set(ruisapp::window_params::buffer::depth);
return wp;
}()
)
Expand Down

0 comments on commit 32ef3b8

Please sign in to comment.