Integrating Ogre-Next and SDL3

My name is André Caldas. I am very very very new to SDL. I have actually never used it… :slight_smile:

Some other thing I have never used is the Ogre library. Right now, I am reading a lot and trying to figure out how to make them both work together in the new software I am writing. Since I do not expect it to be in production anytime soon, I am aiming at SDL3 and the next generation Ogre-Next.

I realize that SDL2 had a method called SDL_CreateWindowFrom (I would put a link here, but new users cannot put more than two links in a post). And in the new SDL3, a bunch of methods for creating a window were uniformized in a single and more flexible SDL_CreateWindowWithProperties.

I realize that referencing an “external window” created by some other library involves some OS/Windowing System dependent code. Now, SDL2 did it in a very simple way: cast the dependent handle to void*. That was very nice, because I could simply get the other library (Ogre Next) to provide me with the OS specific handle and pass it forward to SDL_CreateWindowFrom.

But with SDL3, I have to test for the OS/Windowing System (Mac OS, Wayland, Windows, X11, Android, etc), so I can setup the correct parameter(s). Actually… I am not even sure what the appropriate parameters are! :frowning:

The “migration manual” (sorry, no link) states:

SDL_CreateWindowFrom() - use SDL_CreateWindowWithProperties() with the properties that allow you to wrap an existing window

I do believe the wise developers that have decided SDL_CreateWindowFrom() should be removed, and I accept that. But I still think those same SDL experts know much better what properties need to be set for wrapping an existing window than I do. So, maybe if we had a method to fill out some basic initial SDL_PropertiesID, it would be great! :partying_face:

By the way, like SDL3, Ogre-Next can also use Vulkan… it would be great if I could plug those two great libraries together seamlessly.

If you have a void * handle to an external window, you can set the properties like this:

SDL_SetPointerProperty(props, "sdl2-compat.external_window", native_window);

The official properties give you type safety and better context, but this is a is a shortcut for toolkits and other environments where the type of the native window isn’t readily available.

1 Like