I m trying to build a gui with Pyqt5. and withing the gui there is an openGLwidget, that should contain a rotating cube. But i cannot figure out how to make the cube rotate. Thank you. this is the setup function
def setupUI(self):
self.openGLWidget.initializeGL()
self.openGLWidget.resizeGL(651,551)
self.openGLWidget.paintGL = self.paintGL
self.rotX=10.0
self.rotY=0.0
self.rotZ=0.0
timer = QTimer(self)
timer.timeout.connect(self.Update)
timer.start(1000)
and here is the paintGL and update functions:
def paintGL(self):
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(0,1,0)
self.Cube()
gluPerspective(45, 651/551, 1, 100.0)
glTranslatef(0.0,0.0, -5)
glRotate(self.rotX, 1.0, 0.0, 0.0)
def Update(self):
glClear(GL_COLOR_BUFFER_BIT)
self.rotX+=10
self.openGLWidget.paintGL = self.paintGL