private IntPtr CreateContext()
        {
            Functions.LoadLibrary("opengl32.dll");

            var pf = new PixelFormatDescriptor();

            pf.Init();

            var pixelFormat = OpenGL.ChoosePixelFormat(DeviceContext, ref pf);

            if (!OpenGL.SetPixelFormat(DeviceContext, pixelFormat, ref pf))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            IntPtr hglrc;

            if ((hglrc = OpenGL.wglCreateContext(DeviceContext)) == IntPtr.Zero)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            return(hglrc);
        }
Beispiel #2
0
 public static extern bool SetPixelFormat(HDC hdc, int iPixelFormat, ref PixelFormatDescriptor ppfd);
Beispiel #3
0
 public static extern int DescribePixelFormat(HDC hdc, int iPixelFormat, uint nBytes, out PixelFormatDescriptor ppfd);
Beispiel #4
0
 public static extern int ChoosePixelFormat(HDC hdc, ref PixelFormatDescriptor ppfd);
Beispiel #5
0
		public static extern bool SetPixelFormat(HDC hdc, int iPixelFormat, ref PixelFormatDescriptor ppfd);
Beispiel #6
0
		public static extern int DescribePixelFormat(HDC hdc, int iPixelFormat, uint nBytes, out PixelFormatDescriptor ppfd);
Beispiel #7
0
		public static extern int ChoosePixelFormat(HDC hdc, ref PixelFormatDescriptor ppfd);
 public static extern int ChoosePixelFormat(IntPtr hdc, [In] ref PixelFormatDescriptor ppfd);