import sys
import math
from PyQt5.QtWidgets import QApplication, QMainWindow, QOpenGLWidget
from PyQt5.QtCore import Qt
from OpenGL.GL import *
from OpenGL.GLU import *
from PyQt5.QtCore import QPoint
from PyQt5.QtGui import QMouseEvent
from OpenGL.GL import *
from OpenGL.GLU import *
class OpenGLWidget(QOpenGLWidget):
def __init__(self, parent=None):
super(OpenGLWidget, self).__init__(parent)
self.lastPos = QPoint()
self.translation = [0.0, 0.0, -5.0] # X, Y, and initial Z
self.zoom = 1.0
self.xRot = 0
self.yRot = 0
self.zRot = 0
def initializeGL(self):
glClearColor(0.8, 0.8, 0.8, 1.0)# 设置清屏颜色为灰色
glDisable(GL_LIGHTING) # 禁用光
pyqt opengl 旋转平移缩放
最新推荐文章于 2024-08-31 12:57:41 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)