Rendered to the sdl window

Hi, I would like advice on how to render to an sdl window using openframeworks. I have something like this.

SDL_Init(SDL_INIT_VIDEO);

windowSDL = SDL_CreateWindow(“Můj SDL okno”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH, HEIGHT, SDL_WINDOW_OPENGL);

auto* gl = SDL_GL_CreateContext(windowSDL);

now I need

ofRunApp(new ofApp());

and draw using OF in the SDL window.

Hi,
I think it is a bit more complicated than just that, as OF does not use SDL for windowing, instead it uses GLFW.

There is a really old addon, ofxSDL which might work.
If it does not try making a class for such that extends ofAppBaseWindow. Take a look at how ofAppGLFWWindow class is implemented and you should do more or less the same thing with SDL. It might be a huge task.
Why do you want to use SDL btw?

Also, when running ofRunApp you should do it in the way it is done in the multi windowing examples, where ofRunApp receives 2 arguments, the window and the app.

1 Like

Thanks for the reply.

OfxSDL is old and unusable for me. And I also thought I would have to create extends ofAppBaseWindow, but I rather asked if there is no simple solution.

Why? Becouse I have an openframeworks project that I would like to get on a platform where I get already create SDL window and I have to draw in it.

Hi, If it is that way I dont see any simpler solution that extending ofAppBaseWindow. If you get it to work please make an addon and publish it. :slight_smile: