PyQt5, OpenGL, where to start, minimal example code?

John Ladasky john_ladasky at sbcglobal.net
Sun Oct 9 01:20:42 EDT 2016


Well, I've made some progress.  My program doesn't draw any 3D objects yet, but it creates an OpenGL rendering window, binds the OpenGL functions, and generates no errors.  Here's the corrected initializeGL method:


    def initializeGL(self):
        c = self.context()
        f = QSurfaceFormat()             # The default
        p = QOpenGLVersionProfile(f)
        self.GL = c.versionFunctions(p)
        super().initializeGL()



On Tuesday, October 4, 2016 at 12:56:53 AM UTC-7, Phil Thompson wrote:
> On 4 Oct 2016, at 5:57 am, John Ladasky <j... at s...net> wrote:
> > 
> > On Monday, October 3, 2016 at 1:30:29 AM UTC-7, Phil Thompson wrote:
> >> On 3 Oct 2016, at 4:29 am, John Ladasky <j... at s...net> wrote:
> > If I ever understand a GUI like PyQt5 well enough, I'd like to contribute to its documentation.  Sigh.
> 
> If you are an OpenGL expert 

Ha!  

While I have experience with quite a few scientific computing Python tools (numpy, scipy, matplotlib, pandas, scikit-learn), I know less about OpenGL than I do PyQt5.  There's always more to learn.

>then you could help a lot by answering my questions about how individual functions should be bound.

In all the examples I've encountered on the Net (most of which are written in C++ -- or if they are PyQt examples, they're binding older versions of OpenGL), the preferred approach seems to be the one that I've taken above.  If you want to call an OpenGL function, you have to look it up in the self.GL namespace.



More information about the Python-list mailing list