Using sdl2 for manipulating images in Go

Hello everyone
I’m using sdl2 from this:
But I have a lot of problem with it, if any one has experience with sdl2 please help me. Here is my first problem: I want to find the available number of displays I have, here’s my code:

Num,err :=sdl.GetNumVideoDisplays()
if err!=nil {

But if I plug another display and call the function, it gives me the same amount. I tried calling Init function again but had no success.

Hi. Which platform do you run it on? Windows, Linux or Mac os?

Hi, I run it on Windows and Linux, but right now it is on windows

And it just returns 1 on both?

Are you restarting the actual program, or just checking the result again after plugging in another display? Not sure if SDL2 supports hotplugging for displays.

Yes that’s what I’m trying to do. I have a projector with HDMI and the PC won’t recognize it when the projector is off, so it’s like I plug another display.

Ah, I see. Check to see if it works when restarting the program. SDL2 might just enumerate the number of displays once on program start, rather than when calling the GetNumVideoDisplays() function.

Sorry for my late reply, restarting the program works, but how can we restart the sdl itself without exiting the whole program?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.