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.1.tar.gz (20.5 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.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glsurface-0.1.1.tar.gz
  • Upload date:
  • Size: 20.5 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.1.tar.gz
Algorithm Hash digest
SHA256 56f080bd0045e8435e3c9e84a5494084d3d9021d39d5b7355cae1f0092b589e6
MD5 2d4f521530ec246ebd7dea51c45a93c0
BLAKE2b-256 a96ddabe664fd7d9ccda7a6274313c72236739e05dd4c917c2d186d0c4065db0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glsurface-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8268c22a4c59e118572849a163e15deb9d79a725ef2f5568783926bc54d7a84
MD5 751b9e9df311806a0e9f0030f3e306bc
BLAKE2b-256 320a08f3ec45b841ec878e1f27939538e481708bacc7e8bac12ab73bea561f90

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