Removed terrible hack for SDL_WINDOW_OPENGL

SDL2 will refuse to create an OpenGL context on a window with the SDL_WINDOW_FOREIGN flag (i.e. windows that are passed to SDL2 through SDL_CreateWindowFrom). This must be fixed upstream.
This commit is contained in:
Stefanos A. 2013-10-01 21:05:02 +02:00
parent b57e58dc47
commit ff9cd61777

View file

@ -44,17 +44,10 @@ namespace OpenTK
{ {
this.mode = mode; this.mode = mode;
window_info = Utilities.CreateSdl2WindowInfo(control.Handle); window_info = Utilities.CreateSdl2WindowInfo(control.Handle);
// Fixme: SDL2 will refuse to create an OpenGL context on
// On windows, we must set the SDL_WINDOW_OPENGL flag // a window with the SDL_WINDOW_FOREIGN flag (i.e. windows
// otherwise context creation will fail. // that are passed to SDL2 through SDL_CreateWindowFrom).
if (Configuration.RunningOnWindows) // This must be fixed upstream.
{
// Set SDL_WINDOW_OPENGL in the SDL_Window->flags field
int flags_offset = 52; // 2 * IntPtr.Size + 9 * sizeof(int);
uint flags = (uint)Marshal.ReadInt32(window_info.Handle, 20);
flags |= 2;
Marshal.WriteInt32(window_info.Handle, flags_offset, (int)flags);
}
} }
public Graphics.IGraphicsContext CreateContext(int major, int minor, Graphics.GraphicsContextFlags flags) public Graphics.IGraphicsContext CreateContext(int major, int minor, Graphics.GraphicsContextFlags flags)