public void OnShow()
        {
            _contextPtr = OpenGl.GlXCreateContext(_window.NativeHandle, ref _visualInfo, IntPtr.Zero, true);
            OpenGl.GlXMakeCurrent(_window.NativeHandle, _window.WindowId, _contextPtr);

            WindowExtensions.LoadDefaultOpenGLFunctions();
        }
예제 #2
0
        public IntPtr GetFunctionPtr(string functionName)
        {
            var address = OpenGl.GlXGetProcAddress(functionName);

            if (address == IntPtr.Zero)
            {
                address = OpenGl.GlXGetProcAddressArb(functionName);
            }
            return(address);
        }
        public X11.XVisualInfo GetVisualInfo(X11.XDisplay display)
        {
            var attributes = new[] {
                4 /*GLX_RGBA*/, 1,
                5 /*GLX_DOUBLEBUFFER*/, 1,
                12 /*GLX_DEPTH_SIZE*/, 24,
                0
            };
            var visualInfoPtr = OpenGl.GlXChooseVisual(_window.NativeHandle, display.default_screen, attributes);

            _visualInfo = Marshal.PtrToStructure <X11.XVisualInfo>(visualInfoPtr);
            _display    = display;

            return(_visualInfo);
        }
        public IReadOnlyList <string> GetPlatformExtensions()
        {
            var extensions = OpenGl.GlXQueryExtensionsString(_window.NativeHandle, _display.default_screen);

            return(extensions.Split(' '));
        }
 public void Cleanup()
 {
     OpenGl.GlXMakeCurrent(_window.NativeHandle, 0, IntPtr.Zero);
     OpenGl.GlXDestroyContext(_window.NativeHandle, _contextPtr);
     WindowExtensions.Cleanup();
 }
 public void SwapBuffers()
 {
     OpenGl.GlXSwapBuffers(_window.NativeHandle, _window.WindowId);
 }