i'm trying to make PyQt5 and OpenGL working but cannot figure out what is missing. When i try to run this code i'm getting err 1282
invalid operation
on glTransaltef(0.0, 0.0, -5)
. I tried to google this error, but didn't found anything that involved this function.
app = QApplication(sys.argv)
window = mainWindow.mainWindow()
window.setupUI()
window.show()
sys.exit(app.exec_())
class mainWindow(QMainWindow):
def __init__(self, *args):
super(mainWindow, self).__init__(*args)
loadUi('minimal.ui', self)
def setupUI(self):
self.openGLWidget.initializeGL()
self.openGLWidget.resizeGL(651,551)
gluPerspective(45, 651/551, 0.1, 50.0)
glTranslatef(0.0,0.0, -5)
I'm using .ui file for my GUI layout, and it has openGLWidget object on it, which means ( if i got it correctly ) i don't have to declare QOpenGLWidget, because i already have one and all my OpenGL functions such as glTranslatef
should take effect on what is displayed on this object.