def fit_into_viewport(self): dx, dy, dz = self.compute_home_translation() move_factor = self.translation_move_factor((dx, dy, dz)) mvm = gltbx.util.get_gl_modelview_matrix() for f in animation_stepper(time_move=self.animation_time, move_factor=move_factor): gl.glMatrixMode(gl.GL_MODELVIEW) gl.glLoadIdentity() gl.glTranslated(f * dx, f * dy, f * dz) gl.glMultMatrixd(mvm) self.OnRedraw()
def move_to_center_of_viewport(self, obj_coor): dx, dy = [-x for x in gltbx.util.object_as_eye_coordinates(obj_coor)[:2]] move_factor = self.translation_move_factor((dx, dy, 0)) mvm = gltbx.util.get_gl_modelview_matrix() for f in animation_stepper( time_move=self.animation_time, move_factor=move_factor ): gl.glMatrixMode(gl.GL_MODELVIEW) gl.glLoadIdentity() gl.glTranslated(f * dx, f * dy, 0) gl.glMultMatrixd(mvm) self.OnRedraw()