mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Fixes of VBO rendering on Linux with wxWidgets & GTK
This commit is contained in:
		
							parent
							
								
									b60ae4745f
								
							
						
					
					
						commit
						36416d77b8
					
				
					 3 changed files with 18 additions and 1 deletions
				
			
		|  | @ -906,13 +906,16 @@ sub UseVBOs { | |||
|     my ($self) = @_; | ||||
| 
 | ||||
|     if (! defined ($self->{use_VBOs})) { | ||||
|         # This is a special path for wxWidgets on GTK, where an OpenGL context is initialized | ||||
|         # first when an OpenGL widget is shown for the first time. How ugly. | ||||
|         return 0 if (! $self->init && $^O eq 'linux'); | ||||
|         # Don't use VBOs if anything fails. | ||||
|         $self->{use_VBOs} = 0; | ||||
|         if ($self->GetContext) { | ||||
|             $self->SetCurrent($self->GetContext); | ||||
|             my @gl_version = split(/\./, glGetString(GL_VERSION)); | ||||
|             $self->{use_VBOs} = int($gl_version[0]) >= 2; | ||||
|             # print "InitGL $self OpenGL major: $gl_version[0], minor: $gl_version[1]. Use VBOs: ", $self->{use_VBOs}, "\n"; | ||||
|             # print "UseVBOs $self OpenGL major: $gl_version[0], minor: $gl_version[1]. Use VBOs: ", $self->{use_VBOs}, "\n"; | ||||
|         } | ||||
|     } | ||||
|     return $self->{use_VBOs}; | ||||
|  | @ -968,6 +971,13 @@ sub InitGL { | |||
|     return unless $self->GetContext; | ||||
|     $self->init(1); | ||||
| 
 | ||||
|     # This is a special path for wxWidgets on GTK, where an OpenGL context is initialized | ||||
|     # first when an OpenGL widget is shown for the first time. How ugly. | ||||
|     # In that case the volumes are wainting to be moved to Vertex Buffer Objects | ||||
|     # after the OpenGL context is being initialized. | ||||
|     $self->volumes->finalize_geometry(1)  | ||||
|         if ($^O eq 'linux' && $self->UseVBOs); | ||||
| 
 | ||||
|     glClearColor(0, 0, 0, 1); | ||||
|     glColor3f(1, 0, 0); | ||||
|     glEnable(GL_DEPTH_TEST); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv