예제 #1
0
        static void Main(string[] args)
        {
            SwappableNativeWindowBase window = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 250, 250);

            window.Show();

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

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

            GL.LoadBindings(new OpenToolkitBindingsContext(context));

            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();
        }
예제 #2
0
        public override void SwapBuffers(object image)
        {
            if ((int)image != 0)
            {
                // The game's framebruffer is already bound, so blit it to the window's backbuffer
                GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, 0);

                GL.Clear(ClearBufferMask.ColorBufferBit);
                GL.ClearColor(0, 0, 0, 1);

                GL.BlitFramebuffer(0,
                                   0,
                                   WindowWidth,
                                   WindowHeight,
                                   0,
                                   0,
                                   WindowWidth,
                                   WindowHeight,
                                   ClearBufferMask.ColorBufferBit,
                                   BlitFramebufferFilter.Linear);
            }

            _nativeWindow.SwapBuffers();
        }
예제 #3
0
 public override void SwapBuffers()
 {
     _nativeWindow.SwapBuffers();
 }