Displaying SDL a surface in a QT widget

Has somebody tried that ?

I’m working with Linux and X11.
I made some tries to use SDL in a X window and it works fine.
But I can’t find informations about how to control that window (location,
hiding borders, …).

Any suggestions ?

Richard Nav?os

Hi,

I’ve not tested these, but this guy seems to sugest what you need.

Try this:On Saturday 27 October 2001 02:29, Carsten Pfeiffer wrote:

Converting pixmaps to images is slow – can’t you simply embed the SDL
window into a QWidget? Or doesn’t QXEmbed work?

I found something much easier now, works with every vanilla qwidget:
QString ids;
setenv(“SDL_WINDOWID”, ids.setNum(winId()), 1);

Don’t ask me about portability, it’s an undocumented hack since 1.1 as it
seems…

Josef


I’ve not tried that, following is the first msg:

n Friday 26 October 2001 14:29, Helder Correia wrote:

Hello, is it possible to have an application run as a normal KDE/QT window,
a drawing canvas for instance, and with a mouse click or key sequence go
into a SDL fullscreen mode? I don’t know if I’m making myself clear. In
other words, is there a QT (or KDE) SDL widget? Thanks

Yes.
You either create an SDL surface and map it on your widget, or you define a
widget background and set this as the source for the SDL surface.
I only succeeded the first way, similar to:

SDL_Surface *screen;
screen = SDL_SetVideoMode(200, 200, 24, SDL_SWSURFACE | SDL_ANYFORMAT);

QImage bgimage;
bgimage = new QImage((uchar
)screen->pixels, 200, 200, /24/32, NULL, 256,
QImage::LittleEndian);

QPixmap map;
map.convertFromImage(*x_image);

You might want to optimize this (using bitblt etc).
There is no ready-to-go SDL widget AFAIK.

Josef

on the 05/03/03 08:55, Richard NAVEOS wrote:

Has somebody tried that ?

I’m working with Linux and X11.
I made some tries to use SDL in a X window and it works fine.
But I can’t find informations about how to control that window (location,
hiding borders, …).

Any suggestions ?

Richard Nav?os


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thank you all !

It works fine, with the disadvantage that only one instance of such widget
can run at a time…

Richard.> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of J.
Grant
Sent: mercredi, 5. mars 2003 13:45
To: sdl at libsdl.org
Subject: Re: [SDL] Displaying SDL a surface in a QT widget

Hi,

I’ve not tested these, but this guy seems to sugest what you need.

Try this:

On Saturday 27 October 2001 02:29, Carsten Pfeiffer wrote:

Converting pixmaps to images is slow – can’t you simply embed the SDL
window into a QWidget? Or doesn’t QXEmbed work?

I found something much easier now, works with every vanilla qwidget:
QString ids;
setenv(“SDL_WINDOWID”, ids.setNum(winId()), 1);

Don’t ask me about portability, it’s an undocumented hack since 1.1 as it
seems…

Josef


I’ve not tried that, following is the first msg:

n Friday 26 October 2001 14:29, Helder Correia wrote:

Hello, is it possible to have an application run as a normal KDE/QT
window,
a drawing canvas for instance, and with a mouse click or key sequence go
into a SDL fullscreen mode? I don’t know if I’m making myself clear. In
other words, is there a QT (or KDE) SDL widget? Thanks

Yes.
You either create an SDL surface and map it on your widget, or you define a
widget background and set this as the source for the SDL surface.
I only succeeded the first way, similar to:

SDL_Surface *screen;
screen = SDL_SetVideoMode(200, 200, 24, SDL_SWSURFACE | SDL_ANYFORMAT);

QImage bgimage;
bgimage = new QImage((uchar
)screen->pixels, 200, 200, /24/32, NULL, 256,
QImage::LittleEndian);

QPixmap map;
map.convertFromImage(*x_image);

You might want to optimize this (using bitblt etc).
There is no ready-to-go SDL widget AFAIK.

Josef

on the 05/03/03 08:55, Richard NAVEOS wrote:

Has somebody tried that ?

I’m working with Linux and X11.
I made some tries to use SDL in a X window and it works fine.
But I can’t find informations about how to control that window (location,
hiding borders, …).

Any suggestions ?

Richard Nav?os


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Out of interest, which method did you use and how did the performance fair?

Cheers

JG

on the 05/03/03 15:09, Richard NAVEOS wrote:> Thank you all !

It works fine, with the disadvantage that only one instance of such widget
can run at a time…

Richard.

With my PIII 1.8 GHZ + linux and x11 (no framebuffer)
I got a 220 fps (640x532x32bits)

I use the basic method:

SDL_SetVideoMode( 640, 532, 32, SDL_HWSURFACE );

SDL_LockSurface( screen );

Write data… (removed for testing)
Alpha blending… (removed for testing)

SDL_UnlockSurface( screen );

SDL_UpdateRect( 0, 0, 640, 532 );

When using SHM pixmap I got the same performance.

I know I can get faster but I need x11 (windowed multi-applications
interface), QT and hardware accelerated alpha blending.
I will check for x11 with framebuffer performance today.

Any suggestion…> ----- Original Message -----

From: sdl-admin@libsdl.org [mailto:sdl-admin at libsdl.org]On Behalf Of J.
Grant
Sent: mercredi, 5. mars 2003 18:03
To: sdl at libsdl.org
Subject: Re: [SDL] Displaying SDL a surface in a QT widget

Out of interest, which method did you use and how did the performance fair?

Cheers

JG

on the 05/03/03 15:09, Richard NAVEOS wrote:

Thank you all !

It works fine, with the disadvantage that only one instance of such widget
can run at a time…

Richard.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl