Tech ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES - Use vertex attributes and matrices in shaders. 1st installment.

Shader: flat - Default bed

(cherry picked from commit prusa3d/PrusaSlicer@a5ff37013b)
This commit is contained in:
enricoturri1966 2023-10-23 22:47:07 +08:00 committed by Noisyfox
parent 5fc056edfb
commit 9f4713eee8
6 changed files with 77 additions and 14 deletions

View file

@ -12,6 +12,8 @@
#include "GUI_App.hpp"
#include "GUI_Colors.hpp"
#include "GLCanvas3D.hpp"
#include "Plater.hpp"
#include "Camera.hpp"
#include <GL/glew.h>
@ -702,10 +704,13 @@ void Bed3D::render_default(bool bottom)
update_bed_triangles();
GLShaderProgram *shader = wxGetApp().get_shader("flat");
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
if (shader != nullptr) {
shader->start_using();
const Transform3d matrix = wxGetApp().plater()->get_camera().get_projection_view_matrix();
shader->set_uniform("projection_view_model_matrix", matrix);
glsafe(::glEnable(GL_DEPTH_TEST));
glsafe(::glEnable(GL_BLEND));
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));