Skip to main content

Some helper class

Project description

glsurface

glsurface is a python class to show 2d/3d data with wxPython and PyOpenGL.

Installation

$ pip install glsurface

Usage

  1. Create a class from TrackingSurface
    class Surface(TrackingSurface):
        def __init__(self, *args, **kwargs):
        TrackingSurface.__init__(self, *args, **kwargs)
        ...
    
  2. Create an instance, and set data (optional)
    class SurfacePanel(wx.Panel):
    
        def __init__(self, parent):
            wx.Panel.__init__(self, parent, -1)
            ...
            self.x = np.linspace(0, 2 * np.pi, 30).reshape((1, 30))
            z = np.cos(self.x).T * np.sin(self.x)
            self.canvas = Surface(self, {'z': z})
            ...
    
  3. Update the data
    1. Add new frame data to the current frame buffer
      self.canvas.NewFrameArrive(z, silent=False)
      
    2. Or reset the frame buffer with new data
      self.canvas.SetFrames(points, reset_buf_len=True, silent=False)
      

Check gltest.py for details.

Known issues

  1. On Linux, it may show the following error.

    OpenGL.error.Error: Attempt to retrieve context when no valid context
    

    In this case, try different OpenGL platform, e.g.,

    $ export PYOPENGL_PLATFORM='egl'
    

    All supported platforms can be found here /path/to/python/site-packages/OpenGL/__init__.py

  2. For EGL Surface, you may need to call CreateSurface, as mentioned here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glsurface-0.1.2.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glsurface-0.1.2-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file glsurface-0.1.2.tar.gz.

File metadata

  • Download URL: glsurface-0.1.2.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for glsurface-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a75819f7548e2cf9c98034a8f610365d883de8fd2ba09f3819b95d8bbc9613bf
MD5 9a5d40459299d7c7c57e934c1e1b48d0
BLAKE2b-256 bdd29268daf0d0b28303e848a86158f34450b79588e7a705f9665029fbca1efd

See more details on using hashes here.

File details

Details for the file glsurface-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: glsurface-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for glsurface-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad9fa527b09d510a83e2c9e440adf8d35f539988d1b91f920c437d4de0f55780
MD5 9ebd503ec16eb023e865bd979ba418db
BLAKE2b-256 c6c149eb32d83b7f6a220feaeedd78257517654c08513ece7589343926f73c1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page