Possible to use SDL in browser plugin context?

Possible to use SDL in browser plugin context ?

Just curious. Seems somewhat in contradiction with the notion that SDL seems to be single window app architecture.

Please, any ideas would be appreciated.

Mark Whittemore wrote:

Possible to use SDL in browser plugin context ?

Just curious. Seems somewhat in contradiction with the notion that SDL seems to be single window app architecture.

Please, any ideas would be appreciated.

Seems plausable enough, but most browsers provide their own API that
would give you all the things you’d need. Of course, there is nothing
ever stoping you from just using SDL for surfaces and such. But, I doubt
it would be wise to set a video mode or anything from a plugin.

I believe you can use SDL in a KDE GUI window context as your render
preview. so it should be possible

Cheers

JG

Calvin Spealman wrote:> Mark Whittemore wrote:

Possible to use SDL in browser plugin context ?

Just curious. Seems somewhat in contradiction with the notion that SDL
seems to be single window app architecture.

Please, any ideas would be appreciated.

Seems plausable enough, but most browsers provide their own API that
would give you all the things you’d need. Of course, there is nothing
ever stoping you from just using SDL for surfaces and such. But, I doubt
it would be wise to set a video mode or anything from a plugin.

Mark Whittemore wrote:

Possible to use SDL in browser plugin context ?
Just curious. Seems somewhat in contradiction with the notion that SDL seems to be single window app architecture.

I’ve done it and it “mostly” worked BUT it was not enough flexible as
solution for a releasable plugin.

You can do it with the SDL_WINDOWID hack, just init in the plugin
costructor FIRST the WINDOWID and then SDL and you are able do draw on
your browser window.

The problems are:

  1. You have unpredictable results if the user open a second window with
    another plugin instance and you cannot open two plugin instance in the
    same html page.

  2. Different behaviours with different web browsers. SDL_Quit() use to
    quit netscape on my plugin while it does not harm opera (linux).

  3. If you embed SDL in an activex control you cannot get user events
    since they are filtered through explorer (win32).

  4. You have to SDL_Quit() (or SDL_QuitSubsystem(SDL_INIT_VIDEO) ) every
    time you close an instance of the plugin since the SDL_WINDOWID hack is
    handled in the SDL_Init(SDL_VIDEO_INIT) call.

So definitely I suggest you to minimize the OS dependant code of your
plugin and write it yourself, if you can be license compatible with SDL
maybe you can also cut & paste the routines you need from the SDL
sources :slight_smile:

Bye,
Gabry