A simple Spout2 implementation for sending opengl textures and raw pixel data to spout
-
Add the
Spout.dllfile and thePySpout.pydfiles to your project directory. -
Import the
SpoutSenderfromPySpout -
Create your sender with name and dimensions
-
Call
sender.send_image(frame)whereframeis 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_2Dwith 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 PathandInclude 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
PySpoutproject and openProperties -
Select
All Configurationsfrom the dropdown -
Open the
C/C++section and click onGeneral -
Edit
Additional Include Directoriesand add<your python install path>\includes -
Open the
Linkersection and click onGeneral -
Edit
Additional Library Directoriesand 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
SpoutSDKin the Visual Studio Solutions Explorer, and choosingProperties - Choose
BuildEvents->Post-Build Event - Delete the
Command Lineoption - 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