[PyQt] Unsure how to call glReadPixels

Phil Thompson phil at riverbankcomputing.com
Tue Jun 6 15:39:59 BST 2017


On 2 Jun 2017, at 11:05 pm, Kempinger, Jayson <jkempinger at decisionvis.com> wrote:
> 
> I'm trying to use glReadPixels in my python3 application (python 3.6.1, Qt 5.8.0, and PyQt 5.8.0).
> 
> Here's a segment of my code:
> 
> self.vp = QOpenGLVersionProfile()self.vp.setVersion(2,1)
> self.glFunc = QOpenGLContext.currentContext().versionFunctions(self.vp)
> self.glFunc.glReadPixels(...)
> 
> Regardless of what I pass to the function, I get an error:
> 
> AttributeError: 'QOpenGLFunctions_2_1' object has no attribute 'glReadPixels'
> 
> Running print(dir(self.glFunc) returns a huge list of functions but does not include glReadPixels or any variation that I can find (there's GL_READ_PIXELS but it's an int).
> 
> Am I looking in the wrong place for this function?  I posted to a Qt forum but have not received an answer, so I'm hoping someone can help me here!

It's not implemented simply because I don't know what the best way to do it is.  Specifically how to I calculate how much data will be returned so that I can allocate a buffer of the correct size?

Thanks,
Phil


More information about the PyQt mailing list