SDL_WINDOWID help, please

Hi there,

I’m testing a new version of AlteredSaver for Linux using SDL - nice
library!

[FYI - current non-SDL version at
http://www.AlteredWorlds.com/linux/altered-2.11-full.tar.gz 6.8MB]

In order to function the way I need, I need to be able to supply a
Window ID, use the visual on the window, and display on this window at
the correct size. I’ve included below my X11 code that does this
already.

Can SDL work in this way? I noticed a SDL_WINDOWID environment variable
that can be set, but couldn’t find any description / examples of this
usage.
Also, I’m suspicious that this may not as yet work for OpenGL?

thanks very much for your help,

Tom Gilbert
Owner, Lead Engineer, AlteredWorlds
http://www.AlteredWorlds.com

=============CODE SAMPLE==============
if (useCmdLineWin)
{
XVisualInfo vi_in;
int out_count;
XWindowAttributes xgwa;
awWin = useCmdLineWin;
XGetWindowAttributes (awDpy, awWin, &xgwa);
vi_in.screen = scrnum;
vi_in.visualid = XVisualIDFromVisual(xgwa.visual);
visinfo = XGetVisualInfo(awDpy, VisualScreenMask|VisualIDMask,
&vi_in, &out_count);
AWTRACE2("\nAlteredSaver - Window %x Visual %x
\n\n",awWin,vi_in.visualid);
}


ctx = glXCreateContext( awDpy, visinfo, NULL, True );

XSync(awDpy, false);
glXMakeCurrent( awDpy, awWin, ctx );

Hi there,

I’m testing a new version of AlteredSaver for Linux using SDL - nice
library!

[FYI - current non-SDL version at
http://www.AlteredWorlds.com/linux/altered-2.11-full.tar.gz 6.8MB]

Very cool. Have you thought about using SDL’s GL support? If you do
that, the only time you need to worry about the window id is when the
user passes in a window id for you to render to, and you’ll probably
never need the visual.

Can SDL work in this way? I noticed a SDL_WINDOWID environment variable
that can be set, but couldn’t find any description / examples of this
usage.
Also, I’m suspicious that this may not as yet work for OpenGL?

I’ve never tried it with OpenGL, but there’s no reason why it shouldn’t
work… trying now… it doesn’t work. I’ll take a quick look.

Anyway, just set the SDL_WINDOWID environment variable to a string
representing the window id, in either decimal or hexidecimal. For
fun, you can even do this on the command line with your favorite SDL
application.

Here’s a movie played on my desktop root window:
SDL_WINDOWID=0x26 plaympeg -s 1024x768 ~/mpg/Nadesico_Opening.mpg

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software