Example #1
0
 protected override void Release()
 {
     if (_renderFlag)
     {
         CloseRenderThread();
     }
     CrossContextResource.Dereference();
     SDL.SDL_GL_DeleteContext(_hdc);
 }
Example #2
0
        public Context(Window window)
        {
            var ctx = SDL.SDL_GL_CreateContext(window.Raw());

            if (ctx == null)
            {
                throw new Exception("OpenGL context could not be created! SDL Error: " + SDL.SDL_GetError());
            }
            _hdc  = ctx;
            _host = window;
            SDL.SDL_GL_SetSwapInterval(1);
            if (_isFirstContext)
            {
                Gl.Init(SDL.SDL_GL_GetProcAddress);
                _isFirstContext = false;
            }

            CrossContextResource.Reference();
        }