mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	FIX: modify the shader load error for mac
Change-Id: I3e2b282b145b4d87e09c22d4fec1b88537212d60
This commit is contained in:
		
							parent
							
								
									9558ed242c
								
							
						
					
					
						commit
						b746877d70
					
				
					 5 changed files with 13 additions and 71 deletions
				
			
		|  | @ -45,9 +45,6 @@ std::pair<bool, std::string> GLShadersManager::init() | |||
|     // used to render extrusion and travel paths as lines in gcode preview
 | ||||
|     valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" }); | ||||
| 
 | ||||
|     // used to render cut connectors
 | ||||
|     valid &= append_shader("gouraud_light_uniform", {"gouraud_light_uniform.vs", "gouraud_light_uniform.fs"}); | ||||
| 
 | ||||
|     // used to render objects in 3d editor
 | ||||
|     //if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 0)) {
 | ||||
|     if (0) { | ||||
|  |  | |||
|  | @ -558,11 +558,11 @@ void GLGizmoAdvancedCut::on_render_for_picking() | |||
|         Transform3d scale_tf = Transform3d::Identity(); | ||||
|         scale_tf.scale(Vec3f(connector.radius, connector.radius, height).cast<double>()); | ||||
| 
 | ||||
|         const Transform3d view_model_matrix = camera.get_view_matrix() * translate_tf * m_rotate_matrix * scale_tf; | ||||
|         const Transform3d view_model_matrix = translate_tf * m_rotate_matrix * scale_tf; | ||||
| 
 | ||||
| 
 | ||||
|         std::array<float, 4> color = picking_color_component(i+1); | ||||
|         render_connector_model(m_shapes[connectors[i].attribs], color, view_model_matrix); | ||||
|         render_connector_model(m_shapes[connectors[i].attribs], color, view_model_matrix, true); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -1004,9 +1004,8 @@ void GLGizmoAdvancedCut::render_connectors() | |||
|         Transform3d scale_tf = Transform3d::Identity(); | ||||
|         scale_tf.scale(Vec3f(connector.radius, connector.radius, height).cast<double>()); | ||||
| 
 | ||||
|         const Transform3d view_model_matrix = camera.get_view_matrix() * translate_tf * m_rotate_matrix * scale_tf; | ||||
|         const Transform3d view_model_matrix = translate_tf * m_rotate_matrix * scale_tf; | ||||
| 
 | ||||
|         //render_color = {1.f, 0.f, 0.f, 1.f};
 | ||||
|         render_connector_model(m_shapes[connector.attribs], render_color, view_model_matrix); | ||||
|     } | ||||
| } | ||||
|  | @ -1032,20 +1031,25 @@ void GLGizmoAdvancedCut::render_cut_line() | |||
|     glDisable(GL_LINE_STIPPLE); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoAdvancedCut::render_connector_model(GLModel &model, const std::array<float, 4>& color, Transform3d view_model_matrix) | ||||
| void GLGizmoAdvancedCut::render_connector_model(GLModel &model, const std::array<float, 4> &color, Transform3d view_model_matrix, bool for_picking) | ||||
| { | ||||
|     GLShaderProgram *shader = wxGetApp().get_shader("gouraud_light_uniform"); | ||||
|     glPushMatrix(); | ||||
|     GLShaderProgram *shader = nullptr; | ||||
|     if (for_picking) | ||||
|         shader = wxGetApp().get_shader("cali"); | ||||
|     else | ||||
|         shader = wxGetApp().get_shader("gouraud_light"); | ||||
|     if (shader) { | ||||
|         shader->start_using(); | ||||
| 
 | ||||
|         shader->set_uniform("view_model_matrix", view_model_matrix); | ||||
|         shader->set_uniform("projection_matrix", wxGetApp().plater()->get_camera().get_projection_matrix()); | ||||
|         glsafe(::glMultMatrixd(view_model_matrix.data())); | ||||
| 
 | ||||
|         model.set_color(-1, color); | ||||
|         model.render(); | ||||
| 
 | ||||
|         shader->stop_using(); | ||||
|     } | ||||
|     glPopMatrix(); | ||||
| } | ||||
| 
 | ||||
| void GLGizmoAdvancedCut::clear_selection() | ||||
|  |  | |||
|  | @ -200,7 +200,7 @@ private: | |||
|     void render_connectors(); | ||||
|     void render_clipper_cut(); | ||||
|     void render_cut_line(); | ||||
|     void render_connector_model(GLModel &model, const std::array<float, 4>& color, Transform3d view_model_matrix); | ||||
|     void render_connector_model(GLModel &model, const std::array<float, 4>& color, Transform3d view_model_matrix, bool for_picking = false); | ||||
| 
 | ||||
|     void clear_selection(); | ||||
|     void init_connector_shapes(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 zhimin.zeng
						zhimin.zeng