How pyqt5+opengl can be drawn in functions other than paintGL

problem description

how pyqt5+opengl draws functions other than paintGL

the environmental background of the problems and what methods you have tried

I used makecurrent () but still can"t draw

related codes

/ / Please paste the code text below (do not replace the code with pictures)

def mousePressEvent(self,r):
    if self.paintFig == True:
        self.defaultFramebufferObject()
        self.makeCurrent()
        glClear(GL_COLOR_BUFFER_BIT)
        glPointSize(3.0)  -sharp 
        glColor4f(0.0, 0.0, 0.0, 0.5)
        glBegin(GL_POINTS)
        glVertex2f(0,0)
        glEnd()
        glFlush()
        print(r.button(),r.globalX(),r.x())
        -sharp self.points.append((r.x(),r.y()))

what result do you expect? What is the error message actually seen?

Oct.07,2021
Menu