Пример #1
0
 public bool Activate()
 {
     if (m_hRC != IntPtr.Zero && !m_DC.Disposed)
     {
         return(WGL.MakeCurrent(m_DC.Handle, m_hRC));
     }
     return(false);
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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;
     }
 }
Пример #4
0
 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());
     }
 }
Пример #5
0
 public int GetBufferSwapInterval()
 {
     return(WGL.GetSwapInterval());
 }
Пример #6
0
 public bool SetBufferSwapInterval(int interval)
 {
     return(WGL.SwapInterval(interval));
 }
Пример #7
0
 public void ResetContext()
 {
     WGL.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
 }
Пример #8
0
 public IntPtr GetGLProcAddress(string funcName)
 {
     WGL.EnsureLoaded();
     return(WGL.GetProcAddress(funcName));
 }