예제 #1
0
        public static SPBOpenGLContext CreateBackgroundContext(OpenGLContextBase sharedContext)
        {
            OpenGLContextBase context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, 3, 3, OpenGLContextFlags.Compat, true, sharedContext);
            NativeWindowBase  window  = PlatformHelper.CreateWindow(FramebufferFormat.Default, 0, 0, 100, 100);

            context.Initialize(window);
            context.MakeCurrent(window);

            GL.LoadBindings(new OpenToolkitBindingsContext(context));

            context.MakeCurrent(null);

            return(new SPBOpenGLContext(context, window));
        }
예제 #2
0
        protected override void CreateWindow()
        {
            var flags = OpenGLContextFlags.Compat;

            if (DebugLevel != GraphicsDebugLevel.None)
            {
                flags |= OpenGLContextFlags.Debug;
            }
            _gameBackgroundWindow = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 100, 100);
            _gameBackgroundWindow.Hide();

            GameContext = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, Major, Minor, flags, shareContext: PrimaryContext);
            GameContext.Initialize(_gameBackgroundWindow);
        }
예제 #3
0
파일: GLWidget.cs 프로젝트: zh010zh/Ryujinx
        private void Intialize()
        {
            NativeWindow = RetrieveNativeWindow();

            Window.EnsureNative();

            OpenGLContext = PlatformHelper.CreateOpenGLContext(FramebufferFormat, GLVersionMajor, GLVersionMinor, ContextFlags, DirectRendering, SharedContext);

            OpenGLContext.Initialize(NativeWindow);
            OpenGLContext.MakeCurrent(NativeWindow);

            _initialized = true;

            Initialized?.Invoke(this, EventArgs.Empty);
        }
예제 #4
0
        private void IntializeOpenGL()
        {
            _nativeWindow = RetrieveNativeWindow();

            Window.EnsureNative();

            _openGLContext = PlatformHelper.CreateOpenGLContext(GetGraphicsMode(), 3, 3, _glLogLevel == GraphicsDebugLevel.None ? OpenGLContextFlags.Compat : OpenGLContextFlags.Compat | OpenGLContextFlags.Debug);
            _openGLContext.Initialize(_nativeWindow);
            _openGLContext.MakeCurrent(_nativeWindow);

            // Release the GL exclusivity that SPB gave us as we aren't going to use it in GTK Thread.
            _openGLContext.MakeCurrent(null);

            WaitEvent.Set();

            _initializedOpenGL = true;
        }
예제 #5
0
파일: Program.cs 프로젝트: emmauss/SPB
        static void Main(string[] args)
        {
            NativeWindowBase window = PlatformHelper.CreateWindow(FramebufferFormat.Default, 0, 0, 250, 250);

            OpenGLContextBase context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, 3, 3, OpenGLContextFlags.Compat);

            context.Initialize(window);
            context.MakeCurrent(window);

            GL.LoadBindings(new OpenToolkitBindingsContext(context));

            window.Show();

            GL.ClearColor(1.0f, 0.5f, 1.0f, 1.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit);

            window.SwapBuffers();

            Console.WriteLine($"OpenGL vendor: {GL.GetString(StringName.Vendor)}");
            Console.WriteLine($"OpenGL version: {GL.GetString(StringName.Version)}");
            Console.WriteLine($"OpenGL renderer: {GL.GetString(StringName.Renderer)}");
            Console.WriteLine($"OpenGL context profile mask: {GL.GetInteger((GetPName)All.ContextProfileMask)}");
            Console.WriteLine($"OpenGL context flags: {GL.GetInteger((GetPName)All.ContextFlags)}");

            Thread.Sleep(2000);

            window.Dispose();

            Console.WriteLine($"Dispose OpenGL context!");
            context.Dispose();

            string vendor2 = GL.GetString(StringName.Vendor);

            Console.WriteLine($"OpenGL vendor: {vendor2}");

            window.Dispose();
        }