OpenGL改变视景体无效

问题遇到的现象和发生背景

在用QOpenGLWidget绘图时, resizeGL函数中定义了视景体,我想在缩放时改变视景体,防止缩放时有图形超出视景体范围,但是改变视景体好像不起作用,视景体一直没有变。缩放使用的是glScale。请教一下问题处在哪里。
代码中result后面的数字是为了防止上传是重复临时添加的,实际没有数字

def resizeGL(self, width, height):
        gl.glViewport(0, 0, width, height)
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glLoadIdentity()
        result = 20
        if width <= height:
            gl.glOrtho(-result1, +result2, -result3* height / width, +result4 * height / width, -result4, +result5)
        else:
            gl.glOrtho(-result6* width / height, +result7* width / height, -result8, result9, -result0, +result9)
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity()

def wheelEvent(self, event):
        angle = event.angleDelta() / 8
        angle = angle.y()
        if angle > 0:
            self.scale = self.scale * 1.1
            for i in range(len(self.circlePoint_x)):
                for j in range(3):
                    self.circlePoint_x[i][j] = self.circlePoint_x[i][j] / 1.1
                    self.circlePoint_y[i][j] = self.circlePoint_y[i][j] / 1.1
                    self.circlePoint_z[i][j] = self.circlePoint_z[i][j] / 1.1
        else:
            self.scale = self.scale * 0.9
            for i in range(len(self.circlePoint_x)):
                for j in range(3):
                    self.circlePoint_x[i][j] = self.circlePoint_x[i][j] / 0.9
                    self.circlePoint_y[i][j] = self.circlePoint_y[i][j] / 0.9
                    self.circlePoint_z[i][j] = self.circlePoint_z[i][j] / 0.9
        gl.glMatrixMode(gl.GL_PROJECTION)
        gl.glLoadIdentity()
        x = 0
        for i in range(len(self.modal)):
            for j in range(3):
                if x < abs(self.modal[i][j]):
                    x = abs(self.modal[i][j])
        result = x * 1.2
        if self.width() <= self.height():
            gl.glOrtho(-result1, +result2, -result3* self.height() / self.width(), +result4 * self.height() / self.width(), -result5, +result6)
        else:
            gl.glOrtho(-result7* self.width() / self.height(), +result8* self.width() / self.height(), -result9, +result10, -result11, +result12)
        gl.glMatrixMode(gl.GL_MODELVIEW)
        gl.glLoadIdentity()
        self.update()

scale是用于记录缩放的等级,重点是你在重绘里面没有用到scale
wheelEvent中不需要太多操作,只需要记录scale就好,把其他操作全部放到paintGL中

参考一下: