コード例 #1
0
        public override void Initialize(NativeWindowBase window = null)
        {
            IntPtr windowHandle = IntPtr.Zero;

            if (window != null)
            {
                windowHandle = window.WindowHandle.RawHandle;
            }

            IntPtr sharedContextHandle = IntPtr.Zero;

            if (ShareContext != null)
            {
                sharedContextHandle = ShareContext.ContextHandle;
            }

            IntPtr context = WGLHelper.CreateContext(ref windowHandle, FramebufferFormat, Major, Minor, Flags, DirectRendering, sharedContextHandle);

            ContextHandle = context;

            if (ContextHandle != IntPtr.Zero)
            {
                // If there is no window provided, keep the temporary window around to free it later.
                if (window == null)
                {
                    _windowHandle  = windowHandle;
                    _deviceContext = Win32.Win32.GetDC(windowHandle);
                }
                else
                {
                    _window        = window;
                    _deviceContext = _window.DisplayHandle.RawHandle;
                }
            }

            if (ContextHandle == IntPtr.Zero)
            {
                throw new ContextException("CreateContext() failed.");
            }
        }
コード例 #2
0
 public override IntPtr GetProcAddress(string procName)
 {
     return(WGLHelper.GetProcAddress(procName));
 }