(self)
Paint the visual slice by slice.
Paint the visual slice by slice.
Paint the visual slice by slice .
def paint(self):
        """Paint the visual slice by slice."""
        # do not display non-visible visuals
        if not self.visual.get('visible', True):
            return
            
        # activate the shaders
        try:
            self.shader_manager.activate_shaders()
        # if the shaders could not be successfully activated, stop the
        # rendering immediately
        except Exception as e:
            log_info("Error while activating the shaders: " + str(e))
            return
            
        # update all variables
        self.update_all_variables()
        # bind all texturex for that slice
        self.bind_textures()
        # paint using indices
        if self.use_index:
            self.bind_attributes()
            self.bind_indices()
            Painter.draw_indexed_arrays(self.primitive_type, self.indexsize)
        # or paint without
        elif self.use_slice:
            # draw all sliced buffers
            for slice in xrange(len(self.slicer.slices)):
                # get slice bounds
                slice_bounds = self.slicer.subdata_bounds[slice]
                # print slice, slice_bounds
                # bind all attributes for that slice
                self.bind_attributes(slice)
                # call the appropriate OpenGL rendering command
                # if len(self.slicer.bounds) <= 2:
                # print "slice bounds", slice_bounds
                if len(slice_bounds) <= 2:
                    Painter.draw_arrays(self.primitive_type, slice_bounds[0], 
                        slice_bounds[1] -  slice_bounds[0])
                else:
                    Painter.draw_multi_arrays(self.primitive_type, slice_bounds)
        
        self.copy_all_textures()
        
        # deactivate the shaders
        self.shader_manager.deactivate_shaders()
def paint ( self ) : # do not display non-visible visuals if not self . visual . get ( 'visible' , True ) : return # activate the shaders try : self . shader_manager . activate_shaders ( ) # if the shaders could not be successfully activated, stop the # rendering immediately except Exception as e : log_info ( "Error while activating the shaders: " + str ( e ) ) return # update all variables self . update_all_variables ( ) # bind all texturex for that slice self . bind_textures ( ) # paint using indices if self . use_index : self . bind_attributes ( ) self . bind_indices ( ) Painter . draw_indexed_arrays ( self . primitive_type , self . indexsize ) # or paint without elif self . use_slice : # draw all sliced buffers for slice in xrange ( len ( self . slicer . slices ) ) : # get slice bounds slice_bounds = self . slicer . subdata_bounds [ slice ] # print slice, slice_bounds # bind all attributes for that slice self . bind_attributes ( slice ) # call the appropriate OpenGL rendering command # if len(self.slicer.bounds) <= 2: # print "slice bounds", slice_bounds if len ( slice_bounds ) <= 2 : Painter . draw_arrays ( self . primitive_type , slice_bounds [ 0 ] , slice_bounds [ 1 ] - slice_bounds [ 0 ] ) else : Painter . draw_multi_arrays ( self . primitive_type , slice_bounds ) self . copy_all_textures ( ) # deactivate the shaders self . shader_manager . deactivate_shaders ( )