Code Monkey home page Code Monkey logo

pyspout's Introduction

PySpout

A simple Spout2 implementation for sending opengl textures and raw pixel data to spout

Usage with Raw Pixel Data

  1. Add the Spout.dll file and the PySpout.pyd files to your project directory.

  2. Import the SpoutSender from PySpout

  3. Create your sender with name and dimensions

  4. Call sender.send_image(frame) where frame is a numpy array

# import module
from PySpout import SpoutSender
from OpenGL.GL import GL_RGB


# Create the sender
sender = SpoutSender("MySpoutName", 640, 480, GL_RGB)

while True:
	# get the data as a integer numpy ndarray
	data = get_my_data()

	# try and send the data to spout (use GL_RGBA if your data includes an alpha channel)
	if not sender.send_image(data)

# Finally, when exiting the program, ensure you release the sender 

sender.release()

Usage with OpenGL

Follow steps 1. to 3. above, then:

  1. Create a GL_TEXTURE_2D with a texture id
  2. Call sender.send_texture(texture_id, GL_TEXTURE_2D)

Development / Building yourself

  1. Clone this repo recursively
git clone --recursive [email protected]:off-world-live/pyspout.git
  1. Install python with the official windows installer (not via Microsoft Store), selecting Add to Path and Include Debugging Symbols

Using a different version of python to 3.10

This configuration assumes python has been installed to C:\Users\<yourname>\AppData\Local\Programs\Python310. If you've installed a different python version, you will need to update the following configurations:

  1. Open PySpout.sln with Visual Studio, right click on the PySpout project and open Properties

  2. Select All Configurations from the dropdown

  3. Open the C/C++ section and click on General

  4. Edit Additional Include Directories and add <your python install path>\include

  5. Open the Linker section and click on General

  6. Edit Additional Library Directories and add <your python install path>\libs

  7. Click Apply.

Fixing Spout Post-Build

By default the spout build config will try to copy to a non-existent Binaries/x64 folder. Fix this by:

  1. Clicking on SpoutSDK in the Visual Studio Solutions Explorer, and choosing Properties
  2. Choose BuildEvents->Post-Build Event
  3. Delete the Command Line option
  4. Click Apply

Now you should be able to build :)

License

This implementation is copyright Campbell Morgan, Off World Live Limited but is released open source under the MIT License

pyspout's People

Contributors

campbellwmorgan avatar ammlyy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.