Jump to content

  • Log In with Google      Sign In   
  • Create Account


sdl2 window flashes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 ultramailman   Prime Members   -  Reputation: 1557

Like
0Likes
Like

Posted 15 February 2014 - 03:01 PM

Hello.

 

Anyone notice how when a window is created using sdl2, it immediately closes and a new one is created again? It doesn't seem to have any negative effects, but it does bother me a little. What's going on here?

 

From what I can gather, sdl2 will try to use hardware rendering if possible, so my guess is the first time it makes a window for software rendering, then detects my computer can use hardware rendering, so it closes the window and creates a hardware rendering window. But that happens even if I specify the opengl flag.

 

Any ideas?

 

edit:

the tool chain I use is mingw.

the way I set them up goes like this:

SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_TIMER);
screen = SDL_CreateWindow("shooter game", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_width, window_height, 0);
renderer = SDL_CreateRenderer(screen, -1, 0);

Edited by ultramailman, 15 February 2014 - 06:11 PM.


Sponsor:

#2 richardurich   Members   -  Reputation: 1187

Like
0Likes
Like

Posted 15 February 2014 - 03:54 PM

I only saw that when I was using Qt/qmake doing some tutorial or sample program or whatever, but I normally do not see it. I'm guessing that means it is either caused by the way you create the window, or by extra code injected by specific components of your toolchain. I didn't investigate the cause, so I just don't know what was happening.

 

Can you share the code you're using to create the window? You might just be creating a visible window to obtain an OpenGL context and destroying that. If so, just make it invisible (maybe SDL_WINDOW_SHOWN flag? sorry, not 100% sure since it's not code you type very often). Other than that random guess, I'd have to have more information to work with.



#3 dejaime   Crossbones+   -  Reputation: 3702

Like
0Likes
Like

Posted 15 February 2014 - 04:22 PM

It may be related to some "wizard created projects" with IDEs or maybe display reconfigurations on runtime, but is not how SDL2 works under normal circumstances.

Could you post the code where you create that window?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS