public bool Activate() { if (m_hRC != IntPtr.Zero && !m_DC.Disposed) { return(WGL.MakeCurrent(m_DC.Handle, m_hRC)); } return(false); }
public ResourceContext(ResourceContext rc) { m_DC = rc.m_DC; m_hRC = IntPtr.Zero; if (m_DC == null || m_DC.Disposed) { return; } m_hRC = WGL.CreateContext(m_DC.Handle); if (m_hRC != IntPtr.Zero) { m_DC.BeforeReleaseEvent += OnBeforeDeviceContextRelease; WGL.ShareLists(rc.m_hRC, m_hRC); } }
public void Dispose() { if (m_hRC != IntPtr.Zero) { //GameDebugger.Log("Disposing Resource Context"); if (WGL.GetCurrentContext() == m_hRC) { GL.ResetContext(); } WGL.DeleteContext(m_hRC); m_hRC = IntPtr.Zero; } if (m_DC != null) { m_DC.BeforeReleaseEvent -= OnBeforeDeviceContextRelease; m_DC = null; } }
public ResourceContext(DeviceContext dc) { m_DC = dc; m_hRC = IntPtr.Zero; if (m_DC == null || m_DC.Disposed) { GameDebugger.EngineLog(LogLevel.Error, "Device context cannot be used to create an OpenGL resource context"); return; } m_hRC = WGL.CreateContext(m_DC.Handle); if (m_hRC != IntPtr.Zero) { m_DC.BeforeReleaseEvent += OnBeforeDeviceContextRelease; } else { // GameDebugger.EngineLog(LogLevel.Error, "Trying to create a resouce context returned a null handle. Error was: {0}", GL.GetError()); GameDebugger.EngineLog(LogLevel.Error, "Trying to create a resouce context returned a null handle. Error was: {0}", IGE.Platform.Win32.API.Externals.GetLastError()); } }
public int GetBufferSwapInterval() { return(WGL.GetSwapInterval()); }
public bool SetBufferSwapInterval(int interval) { return(WGL.SwapInterval(interval)); }
public void ResetContext() { WGL.MakeCurrent(IntPtr.Zero, IntPtr.Zero); }
public IntPtr GetGLProcAddress(string funcName) { WGL.EnsureLoaded(); return(WGL.GetProcAddress(funcName)); }