With this code, I do not get a visible window on the screen. Only if I
enable the code that has been commented out is a window actually shown.
I assume that some kind of other step is required to get a non opengl
window to be made visible (unless I go the SDL 1.2 way and call
SDL_SetVideoMode).
I guess what is most confusing is the SDL_ShowWindow function: The name
suggests that if I call this function, the window will become visible,
which is not the case. I must first (for opengl, anyway) create a
context for that to happen. What’s even more confusing: I must first
call SDL_ShowWindow, and then create the context - first creating the
context and then calling showing the window doesn’t work either.
Of course, having figured this out, it’s not really a show stopper, but
certainly an item of curiosity. Perhaps someone could enlighten me as to
why SDL 1.3 behaves this way?
You either have to have an opengl context or a renderer setup. Otherwise, I
don’t think SDL shows a window (which isn’t a bug, to the most of my
knowledge).On Mon, Jan 17, 2011 at 5:12 PM, Matthias Schweinoch < matthias.schweinoch at gmx.de> wrote:
Hi all,
I’m curious about the window creation prerequisites/process in SDL 1.3.
Consider the following code example:
#include <SDL/SDL.h>
int main(int,char**)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
exit(-1);
}
int posx = SDL_WINDOWPOS_CENTERED;
int posy = SDL_WINDOWPOS_CENTERED;
int winw = 320;
int winh = 200;
Uint32 flags = 0;
/* flags |= SDL_WINDOW_OPENGL; */
With this code, I do not get a visible window on the screen. Only if I
enable the code that has been commented out is a window actually shown. I
assume that some kind of other step is required to get a non opengl window
to be made visible (unless I go the SDL 1.2 way and call SDL_SetVideoMode).
I guess what is most confusing is the SDL_ShowWindow function: The name
suggests that if I call this function, the window will become visible, which
is not the case. I must first (for opengl, anyway) create a context for that
to happen. What’s even more confusing: I must first call SDL_ShowWindow, and
then create the context - first creating the context and then calling
showing the window doesn’t work either.
Of course, having figured this out, it’s not really a show stopper, but
certainly an item of curiosity. Perhaps someone could enlighten me as to why
SDL 1.3 behaves this way?
Sorry, I misunderstood you the first time.
I have no idea what’s going on there - what OS are you using (might be Os
specific), and what revision of 1.3 (svn or zipped package)?
That might give other people more information
-AlexOn Mon, Jan 17, 2011 at 5:16 PM, Alex Barry <@Alex_Barry> wrote:
You either have to have an opengl context or a renderer setup. Otherwise,
I don’t think SDL shows a window (which isn’t a bug, to the most of my
knowledge).
On Mon, Jan 17, 2011 at 5:12 PM, Matthias Schweinoch < matthias.schweinoch at gmx.de> wrote:
Hi all,
I’m curious about the window creation prerequisites/process in SDL 1.3.
Consider the following code example:
#include <SDL/SDL.h>
int main(int,char**)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
exit(-1);
}
int posx = SDL_WINDOWPOS_CENTERED;
int posy = SDL_WINDOWPOS_CENTERED;
int winw = 320;
int winh = 200;
Uint32 flags = 0;
/* flags |= SDL_WINDOW_OPENGL; */
With this code, I do not get a visible window on the screen. Only if I
enable the code that has been commented out is a window actually shown. I
assume that some kind of other step is required to get a non opengl window
to be made visible (unless I go the SDL 1.2 way and call SDL_SetVideoMode).
I guess what is most confusing is the SDL_ShowWindow function: The name
suggests that if I call this function, the window will become visible, which
is not the case. I must first (for opengl, anyway) create a context for that
to happen. What’s even more confusing: I must first call SDL_ShowWindow, and
then create the context - first creating the context and then calling
showing the window doesn’t work either.
Of course, having figured this out, it’s not really a show stopper, but
certainly an item of curiosity. Perhaps someone could enlighten me as to why
SDL 1.3 behaves this way?
With this code, I do not get a visible window on the screen. Only if I
enable the code that has been commented out is a window actually shown. I
assume that some kind of other step is required to get a non opengl window
to be made visible (unless I go the SDL 1.2 way and call SDL_SetVideoMode).
I guess what is most confusing is the SDL_ShowWindow function: The name
suggests that if I call this function, the window will become visible, which
is not the case. I must first (for opengl, anyway) create a context for that
to happen. What’s even more confusing: I must first call SDL_ShowWindow, and
then create the context - first creating the context and then calling
showing the window doesn’t work either.
Of course, having figured this out, it’s not really a show stopper, but
certainly an item of curiosity. Perhaps someone could enlighten me as to why
SDL 1.3 behaves this way?
With this code, I do not get a visible window on the screen. Only if I
enable the code that has been commented out is a window actually shown. I
assume that some kind of other step is required to get a non opengl window
to be made visible (unless I go the SDL 1.2 way and call SDL_SetVideoMode).
I guess what is most confusing is the SDL_ShowWindow function: The name
suggests that if I call this function, the window will become visible, which
is not the case. I must first (for opengl, anyway) create a context for that
to happen. What’s even more confusing: I must first call SDL_ShowWindow, and
then create the context - first creating the context and then calling
showing the window doesn’t work either.
Of course, having figured this out, it’s not really a show stopper, but
certainly an item of curiosity. Perhaps someone could enlighten me as to why
SDL 1.3 behaves this way?
I ran this example on a Linux box, Ubuntu 10.04, 2.6.32-27 kernel. The
SDL revision I’m currently using is 4948 (zipped, downloaded from http://www.libsdl.org/tmp/SDL-1.3.zip a few days ago).
I don’t think that the SDL_WINDOW_SHOWN flag is the problem. It actually
makes no difference on my box to add that flag to those passed to
SDL_CreateWindow. I still only see a window if I create an opengl context:
This creates a visible window. If I do not call SDL_GL_CreateContext, no
window is shown (this is regardless of wether or not I pass the
SDL_WINDOW_OPENGL flag into SDL_CreateWindow).
I do want to point out that SDL_ShowWindow does actually affect window
visibility (i.e. if I do not add the SDL_WINDOW_SHOWN flag or do not
call SDL_ShowWindow, then I do not get any visible window, even if I
create an opengl context). However, it seems that creating on opengl
context (or a renderer for non-opengl cases, I assume) is a prerequisite
to actually making the window visible.
i agree, i think windows should be visible when created with optional
SET_HIDDEN/SET_VISIBLE flags
VittorioOn Tue, Jan 18, 2011 at 10:28 AM, Brian Barrett <brian.ripoff at gmail.com> wrote:
I think that is a good idea.
On 17 January 2011 22:24, Sam Lantinga wrote:
By default windows are created hidden, so you should pass in
SDL_WINDOW_SHOWN for flags.
I ran this example on a Linux box, Ubuntu 10.04, 2.6.32-27 kernel. The
SDL revision I’m currently using is 4948 (zipped, downloaded from http://www.libsdl.org/tmp/SDL-1.3.zip a few days ago).
I don’t think that the SDL_WINDOW_SHOWN flag is the problem. It actually
makes no difference on my box to add that flag to those passed to
SDL_CreateWindow. I still only see a window if I create an opengl context:
This creates a visible window. If I do not call SDL_GL_CreateContext, no
window is shown (this is regardless of wether or not I pass the
SDL_WINDOW_OPENGL flag into SDL_CreateWindow).
I do want to point out that SDL_ShowWindow does actually affect window
visibility (i.e. if I do not add the SDL_WINDOW_SHOWN flag or do not
call SDL_ShowWindow, then I do not get any visible window, even if I
create an opengl context). However, it seems that creating on opengl
context (or a renderer for non-opengl cases, I assume) is a prerequisite
to actually making the window visible.
On Windows, it appears regardless of whether you create a renderer or an OpenGL context or not.
Seems like a notable behavioral difference between platforms. Should definitely be fixed.------------------------
EM3 Nathaniel Fries, U.S. Navy