Python GUI + OpenGL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Achim Domma

    #1

    Python GUI + OpenGL

    Hi,

    I'm developing a GUI app in Python/C++ to visualize numerical results.
    Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
    are no windows binaries for Python 2.5 for quite some time now.

    I need a OpenGL context without restrictions and some settings dialogs.
    Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
    of tools/libs?

    regards,
    Achim
  • Diez B. Roggisch

    #2
    Re: Python GUI + OpenGL

    Achim Domma wrote:
    Hi,
    >
    I'm developing a GUI app in Python/C++ to visualize numerical results.
    Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
    are no windows binaries for Python 2.5 for quite some time now.
    >
    I need a OpenGL context without restrictions and some settings dialogs.
    Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
    of tools/libs?
    PyQt, but then there is the licensing question of course.

    Diez

    Comment

    • Mike C. Fletcher

      #3
      Re: Python GUI + OpenGL

      Achim Domma wrote:
      Hi,
      >
      I'm developing a GUI app in Python/C++ to visualize numerical results.
      Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
      are no windows binaries for Python 2.5 for quite some time now.
      >
      I need a OpenGL context without restrictions and some settings dialogs.
      Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
      of tools/libs?
      >
      regards,
      Achim
      >
      PyOpenGL 3.x (currently in alpha state, but reasonably usable) works on
      Python 2.5, there are no binaries because the system no longer requires
      binary versions. Install the setuptools package, then run easy_install
      PyOpenGL and the egg file should be downloaded and installed to your
      machine. The current version doesn't package GLE along with the code,
      however, so you'll have to find a DLL for that if you need it.

      HTH,
      Mike

      --
      _______________ _______________ _______________ ___
      Mike C. Fletcher
      Designer, VR Plumber, Coder



      Comment

      • MonkeeSage

        #4
        Re: Python GUI + OpenGL

        On Mar 2, 9:17 am, Achim Domma <d...@procoders .netwrote:
        I need a OpenGL context without restrictions and some settings dialogs.
        Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
        of tools/libs?
        You could use pygtk + pygtkglext.




        Regards,
        Jordan

        Comment

        • Dag

          #5
          Re: Python GUI + OpenGL

          On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets@nospam.w eb.dewrote:
          Achim Domma wrote:
          >
          >Hi,
          >>
          >I'm developing a GUI app in Python/C++ to visualize numerical results.
          >Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
          >are no windows binaries for Python 2.5 for quite some time now.
          >>
          >I need a OpenGL context without restrictions and some settings dialogs.
          >Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
          >of tools/libs?
          >
          PyQt, but then there is the licensing question of course.
          I'm facing a similar problem. Would you care to explain why PyQt is
          better in this particular case. I've used both PyQt and wx for 'normal'
          GUI programming (but I'm more familiar with wx) so I know about their
          difference in general. But why is PyQt better than wx for working with
          OpenGL?

          Dag

          Comment

          • cptnwillard@gmail.com

            #6
            Re: Python GUI + OpenGL

            You don't necessarily need an OpenGL wrapper like PyOpenGL. If you
            only use a handful of OpenGL functions, it would be relatively
            straight-forward to make your own, using ctypes.

            Here is what it would look like:

            from ctypes import cdll, windll, c_double, c_float, c_int

            GL_POINTS = 0x0000
            GL_LINES = 0x0001
            GL_LINE_LOOP = 0x0002
            GL_LINE_STRIP = 0x0003
            GL_TRIANGLES = 0x0004
            GL_TRIANGLE_STR IP = 0x0005
            GL_TRIANGLE_FAN = 0x0006
            GL_QUADS = 0x0007
            GL_QUAD_STRIP = 0x0008
            GL_POLYGON = 0x0009

            gl = windll.LoadLibr ary("opengl32")

            glEnd = gl.glEnd
            glEnd.restype = None

            glBegin = gl.glBegin
            glBegin.argtype s = [c_int]
            glBegin.restype = None

            glVertex2f = gl.glVertex2d
            glVertex2f.argt ypes = [c_double, c_double]
            glVertex2f.rest ype = None

            glColor3f = gl.glColor3d
            glColor3f.argty pes = [c_double, c_double, c_double]
            glColor3f.resty pe = None

            glClear = gl.glClear
            glClear.argtype s = [c_int]
            glClear.restype = None

            glClearColor = gl.glClearColor
            glClearColor.ar gtypes = [c_double, c_double, c_double, c_double]
            glClearColor.re stype = None

            glViewport = gl.glViewport
            glViewport.argt ypes = [c_int, c_int, c_int, c_int]
            glViewport.rest ype = None

            [...etc]

            Regards,

            Laurent

            On Mar 2, 4:17 pm, Achim Domma <d...@procoders .netwrote:
            Hi,
            >
            I'm developing a GUI app in Python/C++ to visualize numerical results.
            Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
            are no windows binaries for Python 2.5 for quite some time now.
            >
            I need a OpenGL context without restrictions and some settings dialogs.
            Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
            of tools/libs?
            >
            regards,
            Achim

            Comment

            • Diez B. Roggisch

              #7
              Re: Python GUI + OpenGL

              Dag wrote:
              On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets@nospam.w eb.de>
              wrote:
              >Achim Domma wrote:
              >>
              >>Hi,
              >>>
              >>I'm developing a GUI app in Python/C++ to visualize numerical results.
              >>Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
              >>are no windows binaries for Python 2.5 for quite some time now.
              >>>
              >>I need a OpenGL context without restrictions and some settings dialogs.
              >>Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
              >>of tools/libs?
              >>
              >PyQt, but then there is the licensing question of course.
              >
              I'm facing a similar problem. Would you care to explain why PyQt is
              better in this particular case. I've used both PyQt and wx for 'normal'
              GUI programming (but I'm more familiar with wx) so I know about their
              difference in general. But why is PyQt better than wx for working with
              OpenGL?
              I didn't say so. I just pointed out an alternative, as the OP had issues
              with obtaining binary packages for wx + py2.5

              Beside that, I do love the Qt library and would always use it in preference
              to wx, but this is a general thing and by no means tied to the
              OpenGL-programming. After all, that actually is done using PyOpenGL

              Diez

              Comment

              • Chris Mellon

                #8
                Re: Python GUI + OpenGL

                On 3/5/07, Diez B. Roggisch <deets@nospam.w eb.dewrote:
                Dag wrote:
                >
                On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <deets@nospam.w eb.de>
                wrote:
                Achim Domma wrote:
                >
                >Hi,
                >>
                >I'm developing a GUI app in Python/C++ to visualize numerical results.
                >Currently I'm using Python 2.4 with wx and PyOpenGLContext , but there
                >are no windows binaries for Python 2.5 for quite some time now.
                >>
                >I need a OpenGL context without restrictions and some settings dialogs.
                >Is wx + PyOpenGL the way to go? Or could somebody recommend a better set
                >of tools/libs?
                >
                PyQt, but then there is the licensing question of course.
                I'm facing a similar problem. Would you care to explain why PyQt is
                better in this particular case. I've used both PyQt and wx for 'normal'
                GUI programming (but I'm more familiar with wx) so I know about their
                difference in general. But why is PyQt better than wx for working with
                OpenGL?
                >
                I didn't say so. I just pointed out an alternative, as the OP had issues
                with obtaining binary packages for wx + py2.5
                >
                I believe he was having trouble with binary packages for PyOpenGL,
                wxPython has 2.5 binaries and has since it was released.

                That said, it's my understanding that the most recent version of
                PyOpenGL uses ctypes and no longer requires a windows binary, which is
                why they are not provided.

                Also, if you're writing a C++/Python app on Windows then you must have
                the correct environment to build Python extensions, so even if my
                understanding is incorrect, you should be able to build PyOpenGL via
                distutils with minimal if any trouble.
                Beside that, I do love the Qt library and would always use it in preference
                to wx, but this is a general thing and by no means tied to the
                OpenGL-programming. After all, that actually is done using PyOpenGL
                >
                wx and Qt support OpenGL in essentially the same manner. I believe he
                took from your earlier post that Qt had its own built in OpenGL
                wrapper (and thus didn't rely on PyOpenGL) but to my knowledge that is
                not correct.

                Comment

                • David Boddie

                  #9
                  Re: Python GUI + OpenGL

                  On Monday 05 March 2007 18:22, Chris Mellon wrote:
                  On 3/5/07, Diez B. Roggisch <deets@nospam.w eb.dewrote:
                  >Beside that, I do love the Qt library and would always use it in
                  >preference to wx, but this is a general thing and by no means tied to the
                  >OpenGL-programming. After all, that actually is done using PyOpenGL
                  >
                  wx and Qt support OpenGL in essentially the same manner. I believe he
                  took from your earlier post that Qt had its own built in OpenGL
                  wrapper (and thus didn't rely on PyOpenGL) but to my knowledge that is
                  not correct.
                  Yes, you need PyOpenGL (or any other suitable OpenGL wrapper) to use
                  OpenGL with PyQt. Qt itself doesn't provide its own API for OpenGL; you
                  just use the implementation available on your system.

                  It is possible to get OpenGL-rendered 2D graphics without having
                  PyOpenGL installed; you just paint on a QGLWidget in the usual way.
                  However, I suspect that the original poster wanted to render 3D
                  graphics, so Python bindings to the system's OpenGL library are still
                  required.

                  David

                  Comment

                  • Diez B. Roggisch

                    #10
                    Re: Python GUI + OpenGL

                    >I didn't say so. I just pointed out an alternative, as the OP had issues
                    >with obtaining binary packages for wx + py2.5
                    >>
                    >
                    I believe he was having trouble with binary packages for PyOpenGL,
                    wxPython has 2.5 binaries and has since it was released.

                    Ah, I didn't read it that way as the OP didn't say exactly _what_ package he
                    was missing. Obviously if it's PyOpenGL then using Qt won't buy him much...


                    Diez

                    Comment

                    Working...