BraveSirAndrew's picture

GLControl and SDL

Hi

Just wondering if there's been any progress on this? I've been trying to make it work for the past couple of days and I've made *some* progress, but can't get anything to actually render to the control. I've managed to patch SDL so that it will create an OpenGL window in SDL_CreateWindowFrom (fully intend on making a blog post about this process as there's so little information online about how to do it!) and I'm calling CreateWindowFrom from Sdl2GraphicsContext. It seems to be handing back a valid window. I can create a context from it, no errors are thrown, the graphics mode seems to be correct, it's just that nothing renders to the control, not even the clear colour. I'm sort of at a dead end with this now, so I was hoping there was something obvious that needs to be implemented that I've overlooked. Any help would be great!

Thanks


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
BraveSirAndrew's picture

Anybody? Is there anything else that I would need to do to get this working other than:

  1. Modify SDL so that it can create an OpenGL window in SDL_CreateWindowFrom when handed a foreign window
  2. Change the Sdl2GraphicsContext constructor so that it calls CreateWindowFrom when running from a GLControl implementation

I thought maybe it was something to do with having to pump SDL events manually, since Windows will be pumping the Winforms window and maybe SDL isn't able to hook into those. I tried hacking that solution together but it didn't help. Could really do with some guidance on this.

the Fiddler's picture

I tried a similar approach last September, but I didn't manage to get it working either. What I did was modify SDL_CreateWindowFrom to enable OpenGL and then use that in Sdl2GLControl (sdl_winforms branch).

Right now, I think that the simplest approach might be to reparent the SDL window inside WinForms. Looks simple enough to be worth a try.