Пример #1
0
 protected override void OnRenderFrame(FrameEventArgs e)
 {
     // called once per frame; render
     app.Tick();
     if (terminated)
     {
         Exit();
         return;
     }
     // convert MyApplication.screen to OpenGL texture
     GL.BindTexture(TextureTarget.Texture2D, screenID);
     GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
                   app.screen.width, app.screen.height, 0,
                   OpenTK.Graphics.OpenGL.PixelFormat.Bgra,
                   PixelType.UnsignedByte, app.screen.pixels
                   );
     // draw screen filling quad
     GL.Begin(PrimitiveType.Quads);
     GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(-1.0f, -1.0f);
     GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(1.0f, -1.0f);
     GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(1.0f, 1.0f);
     GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(-1.0f, 1.0f);
     GL.End();
     // tell OpenTK we're done rendering
     SwapBuffers();
 }
Пример #2
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            if (terminated || time == 100)
            {
                s.Stop();
                Console.WriteLine(s.ElapsedMilliseconds);
                Exit();
                return;
            }
            app.Tick();

            // convert MyApplication.screen to OpenGL texture
            GL.BindTexture(TextureTarget.Texture2D, screenID);
            GL.TexImage2D(TextureTarget.Texture2D,
                          0,
                          PixelInternalFormat.Rgba,
                          app.screen.width,
                          app.screen.height,
                          0,
                          OpenTK.Graphics.OpenGL.PixelFormat.Bgra,
                          PixelType.UnsignedByte,
                          app.screen.pixels);
            // draw screen filling quad
            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(-1.0f, -1.0f);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(1.0f, -1.0f);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(1.0f, 1.0f);
            GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(-1.0f, 1.0f);
            GL.End();
            // tell OpenTK we're done rendering
            SwapBuffers();
            time++;
        }
Пример #3
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            // called once per frame; render
            app.Tick();
            if (terminated)
            {
                Exit();
                return;
            }

            // tell OpenTK we're done rendering
            SwapBuffers();
        }
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            // called once per frame; render
            app.Tick();
            if (terminated)
            {
                Exit();
                return;
            }
            // set the state for rendering the quad
            GL.ClearColor(Color.Black);
            GL.Enable(EnableCap.Texture2D);
            GL.Disable(EnableCap.DepthTest);
            GL.Color3(1.0f, 1.0f, 1.0f);

            // convert MyApplication.Screen to OpenGL texture
            GL.BindTexture(TextureTarget.Texture2D, screenID);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
                          app.screen.width, app.screen.height, 0,
                          OpenTK.Graphics.OpenGL.PixelFormat.Bgra,
                          PixelType.UnsignedByte, app.screen.pixels
                          );
            // draw screen filling quad
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();

            // draw screen filling quad
            GL.Begin(PrimitiveType.Quads);
            GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(-1.0f, -1.0f);
            GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(1.0f, -1.0f);
            GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(1.0f, 1.0f);
            GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(-1.0f, 1.0f);
            GL.End();

            // prepare for generic OpenGL rendering
            GL.Enable(EnableCap.DepthTest);
            GL.Clear(ClearBufferMask.DepthBufferBit);
            GL.Disable(EnableCap.Texture2D);

            // do OpenGL rendering
            app.RenderGL();

            // swap buffers
            SwapBuffers();
        }
Пример #5
0
 protected override void OnRenderFrame(FrameEventArgs e)
 {
     // called once per frame; render
     app.Tick();
     if (terminated)
     {
         Exit();
         return;
     }
     // convert MyApplication.screen to OpenGL texture
     GL.ActiveTexture(TextureUnit.Texture0);
     GL.BindTexture(TextureTarget.Texture2D, app.img);
     GL.Begin(PrimitiveType.Quads);
     GL.TexCoord2(0.0f, 1.0f); GL.Vertex2(-1.0f, -1.0f);
     GL.TexCoord2(1.0f, 1.0f); GL.Vertex2(1.0f, -1.0f);
     GL.TexCoord2(1.0f, 0.0f); GL.Vertex2(1.0f, 1.0f);
     GL.TexCoord2(0.0f, 0.0f); GL.Vertex2(-1.0f, 1.0f);
     GL.End();
     GL.BindTexture(TextureTarget.Texture2D, 0);
     // tell OpenTK we're done rendering
     SwapBuffers();
 }