Using sdl2 for manipulating images in Go

(Pourya Torabi) #1

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.

(Johan Dahl) #2

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

(Pourya Torabi) #3

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

(Johan Dahl) #4

And it just returns 1 on both?

(Solar Lune) #5

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.

(Pourya Torabi) #6

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.

(Solar Lune) #7

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.