Receiver not connecting using Spout 2 DLL


I am currently developing a new QML Image type, that should receive and display Spout textures. I have already created a Spout sender, which works fine. But the receiver just won´t connect.

As I am bound to use Qt / QML, I only have the option of using the Spout 2 dll. Here is in short the commands I am using:

#include “SpoutLibrary.h”
SPOUTHANDLE m_spoutptr = nullptr;

m_spoutptr = GetSpout(); <-- Works fine
m_spoutptr->SetDX9(false); <-- true or false doesn´t change a thing, left it at false

qDebug()<< "Current senders: " << m_spoutptr->GetSenderCount();  <--Shows 1 sender, is  correct
char senderName[64];
int maxSize = 64;
int index = 0; // or based on GetSenderCount
m_spoutptr->GetSenderName(index, senderName, maxSize); 
qDebug()<< "SenderName:" << senderName;  <-- Shows correct sender name

unsigned int width = 500, height = 500;

m_spoutptr->CreateReceiver(senderName,width,height); <-- Does always return false, regardless of
when or how often I call that function. 

And this is my problem, the CreateReceiver just won´t work. It shouldn´t be a problem with the senderName, because it is taken from the SpoutLibrary function itself…

One thing that I noticed is that AFTER ending my session with
m_spoutptr->ReleaseReceiver(); // Release the sender
m_spoutptr->Release(); // Release the Spout library instance

There are always these console logs:
loadFBOextensions fail
loadFBOextensions fail
loadFBOextensions fail
loadFBOextensions fail

Has someone experience with combining QT / QML and Spout? Please, every help would be welcome!

Hi @KKleinke . I hope we can resolve this.

If the OpenGL FBO extensions fail to load it’s likely that the hardware does not support them. I have seen this some time back with Intel HD graphics, 3000 I think. To confirm this you can run the demo sender and select Help > Diagnostics. Click copy and then paste the result here. It should show the graphics adapter.

This doesn’t make sense though if you are using OpenGL with QT. I have had communication with one person using QT and have looked into it a little. But before I can suggest anythng else could you please let me know whether you are using OpenGL textures or pixel images.

Thank you for your fast reply!
The DemoSender & DemoReceiver both work as intended. The diagnostic returned:
Spout Sender (Vers 2.018)
DirectX 9.0c available
NIVIDIA GeForce RTX 2080 (Display)
Microsoft Basic Render Driver (Secondary)
Current adapter: NVIDIA Corporation
NV_DX_interop extension available
DirectX 11 Texture share mode

For your last question, I am a little unsure. I use Spout to connect a QML application with Unity 3D. So in my Unity application, I am running klak/spout as a library, which comes with predefined sender / receiver components.

My sender (which works) takes a window in QML, uses a FrameBufferObject to extract the texture and sends it over to Unity. Everything fine here.

My receiver won´t be created, even when methods like GetSenderName(…) cleary show that it is able to detect a sender from Unity.

The NVIDIA hardware can’t be the problem then, and you must be using OpenGL if you are using a FrameBufferObject for your sender. The strange thing is that the sender should also fail to load the FBO extensions because it is common for both sender and receiver.

The receiver will detect senders and names etc, because that does not require any texture processing. I can’t think of a quick test that might reveal the cause.

One possibility is to try the 2.007 beta version of SpoutLibrary. You will need to use the corresponding library, dll and header files.

The original 2.006 functions remain and it should build OK. If that works, there are new logging functions and you could use :

EnableSpoutLogFile("QML_application.log"); // Log to file

Log files are saved in the %AppData% folder
(e.g. C:>Users>username>AppData>Roaming>Spout)
unless you specify the full path. The saved log should show where the application is failing and narrow down the cause.

I have changed the .dll, .h and .lib to the beta files as suggested.

Hmm I have included the EnableSpoutLogFile(“QML_application.log”); // Log to file but there is no logfile created on my PC. The application now crashes on CreateReceiver…

OK obviously there’s something wrong there.
You can also try - EnableSpoutLog();
But the fact that it crashes mean that the fbo error is still there. I will see what I can do about catching this.

EnableSpoutLog() still does not generate any logfile in appdata. Even if I uncomment the CreateReceiver() command to avoid crashes

In addition, the programm even crashes if I just use Release(), even when no receivers were created. This is new and seems to be connected to the beta dll

As the beta dll crashes my software, I switched back to stable. I noticed that the function GetNumAdapters(); returns 0. Could this be connected to the problem in some kind?

It certainly could. But the fundamental problem is that your sender is OK and the receiver is not.

I would suggest to strip back both to the bare minimum with a common function like GetNumAdapters() and nothing else.

Both should work exactly the same. If not, the problem is most likely not the library itself, but something else.

I traced this through. The exact error message is within the function to load fbo extensions so I am sure that is the proplem. But I also notice -

char senderName[64];

GetSenderName allows a maximum size, but all other functions require sender names to be 256 bytes, so change it to -

char senderName[256];

If that does not resolve it, you can try -

m_spoutptr = GetSpout();
char senderName[256];
unsigned int width = 500, height = 500;
if(m_spoutptr->CreateReceiver(senderName,width,height)) {
    qDebug()<< "SenderName:" << senderName;

and finally on program close -


There could be other issues but it’s worth a try.

Changing the senderName has not solved the issue. Using CreateOpenGl() without the beta library is not possible, with beta library, the command crashes my software at that point.

Also thank you for all the help until now, i really appreciate it

Ok, I am one little step further… I changed some parts of my sender code to instead create a receiver and it worked. Currently I am quite unsure where the problem arises, but I will update you once I have found out more

I think you are on the right track to build up from something that is working. I had a look at QT but it would take me too long to become familiar with it. My guess is that it’s something to with lack of OpenGL context.

Okay… the main difference seems to be how the function is called, that includes CreateReceiver…

If I try it in the Constructor, it will always fail
If I call it via timer timeout, it will always fail
If I connect it with QWindow and only call it via connecting it to the BeforeRender step, it works

m_parent = qobject_cast<QQuickItem*>(this->parent());
    qDebug()<< m_parent->window();
    m_window = m_parent->window();
    connect(m_window, &QQuickWindow::beforeRendering,
            this, &TextureImage::updateDebug, Qt::DirectConnection);

I think you have lost me there, but that’s clearly the solution.

My other concern is that the beta library crashes. There could be some work required there but I am not sure what.

I wonder whether you could help by exchanging the libraries in the sender project which normally works OK and let me know the result. Any crash log or something like that would help.

The beta library in my current sender implementation is only capable of getting a Spout instance.
When I attempt to create a sender, it throws a segmentation fault.
Also using setDX9() crashes my programm. When I use the normal library, it works fine.

I think my main problem is that using QT / QML, the genereal rendering is handled via QScreneGraph, which manipulates OpenGL currentContext etc
As I am not an expert regarding OpenGL, I can only guess that the Spout is trying to access the context but Qt / QML blocks that, which leads to crashes.

I have stripped down my project to only using minimal examples of my sender / receiver implementations. If you want, I can share the project with you

Thankyou, that’s very generous and I would appreciate that. If you could initially make contact via email, I will get back to you with a forwarding address.

I have QT installed and can open projects and the basics. My main concern is to get the new version of SpoutLibrary working with QT.