A simple Spout2 implementation for sending opengl textures and raw pixel data to spout
-
Add the
Spout.dll
file and thePySpout.pyd
files to your project directory. -
Import the
SpoutSender
fromPySpout
-
Create your sender with name and dimensions
-
Call
sender.send_image(frame)
whereframe
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()
Follow steps 1. to 3. above, then:
- Create a
GL_TEXTURE_2D
with atexture id
- Call
sender.send_texture(texture_id, GL_TEXTURE_2D)
- Clone this repo recursively
git clone --recursive git@github.com:off-world-live/pyspout.git
- Install python with the official windows installer (not via Microsoft Store), selecting
Add to Path
andInclude Debugging Symbols
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:
-
Open PySpout.sln with Visual Studio, right click on the
PySpout
project and openProperties
-
Select
All Configurations
from the dropdown -
Open the
C/C++
section and click onGeneral
-
Edit
Additional Include Directories
and add<your python install path>\includes
-
Open the
Linker
section and click onGeneral
-
Edit
Additional Library Directories
and add<your python install path>\Lib
-
Click Apply.
By default the spout build config will try to copy to a non-existent Binaries/x64
folder.
Fix this by:
- Clicking on
SpoutSDK
in the Visual Studio Solutions Explorer, and choosingProperties
- Choose
BuildEvents->Post-Build Event
- Delete the
Command Line
option - Click
Apply
Now you should be able to build :)
This implementation is copyright Campbell Morgan, Off World Live Limited but is released open source under the MIT License