# Receiver not connecting using Spout 2 DLL

**URL:** <https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94>\
**Category:** Developer\
**Created:** [July 8, 2020, 12:16pm UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94 "2020-07-08T12:16:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 8, 2020, 12:16pm UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/1 "2020-07-08T12:16:03Z")

</div>

Hello.

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:

## HEADER #include “SpoutLibrary.h” SPOUTHANDLE m\_spoutptr = nullptr;

CLASS  
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!

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 9, 2020, 1:09am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/2 "2020-07-09T01:09:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 9, 2020, 6:14am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/3 "2020-07-09T06:14:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 9, 2020, 7:01am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/4 "2020-07-09T07:01:49Z")

</div>

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](https://github.com/leadedge/Spout2/tree/beta/SPOUTSDK/SpoutLibrary) 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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 9, 2020, 8:16am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/5 "2020-07-09T08:16:49Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 9, 2020, 9:09am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/6 "2020-07-09T09:09:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 9, 2020, 9:13am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/7 "2020-07-09T09:13:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 9, 2020, 11:02am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/8 "2020-07-09T11:02:32Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 9, 2020, 1:47pm UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/9 "2020-07-09T13:47:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 10, 2020, 3:13am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/10 "2020-07-10T03:13:15Z")

</div>

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();
m_spoutptr->CreateOpenGL();
char senderName[256];
unsigned int width = 500, height = 500;
if(m_spoutptr->CreateReceiver(senderName,width,height)) {
    qDebug()<< "SenderName:" << senderName;
}

```

and finally on program close -

```
m_spoutptr->CloseOpenGL();

```

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

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 10, 2020, 6:10am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/11 "2020-07-10T06:10:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 10, 2020, 6:19am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/12 "2020-07-10T06:19:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 10, 2020, 6:31am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/13 "2020-07-10T06:31:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 10, 2020, 7:27am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/14 "2020-07-10T07:27:31Z")

</div>

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());
if(m_parent){
    qDebug()<< m_parent->window();
    m_window = m_parent->window();
    connect(m_window, &QQuickWindow::beforeRendering,
            this, &TextureImage::updateDebug, Qt::DirectConnection);
}
```

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 10, 2020, 8:31am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/15 "2020-07-10T08:31:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 10, 2020, 8:47am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/16 "2020-07-10T08:47:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KKleinke](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@KKleinke](https://spout.discourse.group/u/KKleinke)\
**Post date:** [July 10, 2020, 9:14am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/17 "2020-07-10T09:14:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [July 10, 2020, 1:56pm UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/18 "2020-07-10T13:56:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![izag](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@izag](https://spout.discourse.group/u/izag)\
**Post date:** [February 26, 2021, 12:20am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/19 "2021-02-26T00:20:24Z")

</div>

I would be grateful if you would share your version 🙏

---

<div class="post-metadata">

**Author:** ![spout](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@spout](https://spout.discourse.group/u/spout)\
**Post date:** [February 26, 2021, 12:23am UTC](https://spout.discourse.group/t/receiver-not-connecting-using-spout-2-dll/94/20 "2021-02-26T00:23:33Z")

</div>

Sorry @izag, your post got held up in the system.

I have lost touch with this and don’t have time to re-visit the project. You best bet may be to send @KKleinke a private message.
